From f37979e60f747120ee66ae9547a2591f465910c3 Mon Sep 17 00:00:00 2001 From: AprilWind <2100166581@qq.com> Date: Fri, 31 May 2024 15:27:28 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20forest=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E5=B7=A5=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 7 ++++ ruoyi-common/pom.xml | 1 + ruoyi-common/ruoyi-common-bom/pom.xml | 7 ++++ ruoyi-common/ruoyi-common-forest/pom.xml | 42 +++++++++++++++++++ .../forest/config/ForestConfiguration.java | 28 +++++++++++++ .../forest/exception/ForestException.java | 25 +++++++++++ .../handler/ForestExceptionHandler.java | 30 +++++++++++++ .../common/forest/utils/ForestUtils.java | 34 +++++++++++++++ ...ot.autoconfigure.AutoConfiguration.imports | 1 + .../src/main/resources/common-forest.yml | 38 +++++++++++++++++ 10 files changed, 213 insertions(+) create mode 100644 ruoyi-common/ruoyi-common-forest/pom.xml create mode 100644 ruoyi-common/ruoyi-common-forest/src/main/java/org/dromara/common/forest/config/ForestConfiguration.java create mode 100644 ruoyi-common/ruoyi-common-forest/src/main/java/org/dromara/common/forest/exception/ForestException.java create mode 100644 ruoyi-common/ruoyi-common-forest/src/main/java/org/dromara/common/forest/handler/ForestExceptionHandler.java create mode 100644 ruoyi-common/ruoyi-common-forest/src/main/java/org/dromara/common/forest/utils/ForestUtils.java create mode 100644 ruoyi-common/ruoyi-common-forest/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports create mode 100644 ruoyi-common/ruoyi-common-forest/src/main/resources/common-forest.yml diff --git a/pom.xml b/pom.xml index a0912de50..f01461858 100644 --- a/pom.xml +++ b/pom.xml @@ -340,6 +340,13 @@ ${fastjson.version} + + + com.dtflys.forest + forest-spring-boot3-starter + ${forest.version} + + org.dromara ruoyi-system diff --git a/ruoyi-common/pom.xml b/ruoyi-common/pom.xml index 45493d3e9..c2b6c4c0e 100644 --- a/ruoyi-common/pom.xml +++ b/ruoyi-common/pom.xml @@ -15,6 +15,7 @@ ruoyi-common-core ruoyi-common-doc ruoyi-common-excel + ruoyi-common-forest ruoyi-common-idempotent ruoyi-common-job ruoyi-common-log diff --git a/ruoyi-common/ruoyi-common-bom/pom.xml b/ruoyi-common/ruoyi-common-bom/pom.xml index f9af9de0f..9ff58dda2 100644 --- a/ruoyi-common/ruoyi-common-bom/pom.xml +++ b/ruoyi-common/ruoyi-common-bom/pom.xml @@ -40,6 +40,13 @@ ${revision} + + + org.dromara + ruoyi-common-forest + ${revision} + + org.dromara diff --git a/ruoyi-common/ruoyi-common-forest/pom.xml b/ruoyi-common/ruoyi-common-forest/pom.xml new file mode 100644 index 000000000..8f60e0c7f --- /dev/null +++ b/ruoyi-common/ruoyi-common-forest/pom.xml @@ -0,0 +1,42 @@ + + + + ruoyi-common + org.dromara + ${revision} + + 4.0.0 + + ruoyi-common-forest + + + ruoyi-common-forest forest框架的http服务 + + + + https://forest.dtflyx.com/pages/1.5.33/intro/ + + + + + + org.dromara + ruoyi-common-core + + + + org.dromara + ruoyi-common-json + + + + + com.dtflys.forest + forest-spring-boot3-starter + + + + + diff --git a/ruoyi-common/ruoyi-common-forest/src/main/java/org/dromara/common/forest/config/ForestConfiguration.java b/ruoyi-common/ruoyi-common-forest/src/main/java/org/dromara/common/forest/config/ForestConfiguration.java new file mode 100644 index 000000000..1eeb4ed5a --- /dev/null +++ b/ruoyi-common/ruoyi-common-forest/src/main/java/org/dromara/common/forest/config/ForestConfiguration.java @@ -0,0 +1,28 @@ +package org.dromara.common.forest.config; + +import lombok.extern.slf4j.Slf4j; +import org.dromara.common.core.factory.YmlPropertySourceFactory; +import org.dromara.common.forest.handler.ForestExceptionHandler; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.PropertySource; + +/** + * Forest 配置属性 + * + * @author AprilWind + */ +@Slf4j +@AutoConfiguration +@PropertySource(value = "classpath:common-forest.yml", factory = YmlPropertySourceFactory.class) +public class ForestConfiguration { + + /** + * Forest异常处理器 + */ + @Bean + public ForestExceptionHandler forestExceptionHandler() { + return new ForestExceptionHandler(); + } + +} diff --git a/ruoyi-common/ruoyi-common-forest/src/main/java/org/dromara/common/forest/exception/ForestException.java b/ruoyi-common/ruoyi-common-forest/src/main/java/org/dromara/common/forest/exception/ForestException.java new file mode 100644 index 000000000..0508ee8b9 --- /dev/null +++ b/ruoyi-common/ruoyi-common-forest/src/main/java/org/dromara/common/forest/exception/ForestException.java @@ -0,0 +1,25 @@ +package org.dromara.common.forest.exception; + +import org.dromara.common.core.exception.base.BaseException; + +import java.io.Serial; + +/** + * Forest第三方请求异常类 + * + * @author AprilWind + */ +public class ForestException extends BaseException { + + @Serial + private static final long serialVersionUID = 1L; + + public ForestException(String msg) { + super("forest", msg); + } + + public ForestException(String code, Object[] args) { + super("forest", code, args, null); + } + +} diff --git a/ruoyi-common/ruoyi-common-forest/src/main/java/org/dromara/common/forest/handler/ForestExceptionHandler.java b/ruoyi-common/ruoyi-common-forest/src/main/java/org/dromara/common/forest/handler/ForestExceptionHandler.java new file mode 100644 index 000000000..509680ca9 --- /dev/null +++ b/ruoyi-common/ruoyi-common-forest/src/main/java/org/dromara/common/forest/handler/ForestExceptionHandler.java @@ -0,0 +1,30 @@ +package org.dromara.common.forest.handler; + +import cn.hutool.http.HttpStatus; +import jakarta.servlet.http.HttpServletRequest; +import lombok.extern.slf4j.Slf4j; +import org.dromara.common.core.domain.R; +import org.dromara.common.forest.exception.ForestException; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.RestControllerAdvice; + +/** + * Forest异常处理器 + * + * @author AprilWind + */ +@Slf4j +@RestControllerAdvice +public class ForestExceptionHandler { + + /** + * 请求第三方异常 + */ + @ExceptionHandler(ForestException.class) + public R handleForestException(ForestException e, HttpServletRequest request) { + String requestURI = request.getRequestURI(); + log.error("请求地址'{}',forest请求第三方异常." + requestURI, e.getMessage()); + return R.fail(HttpStatus.HTTP_UNAVAILABLE, "抱歉,服务暂时无法响应您的请求..."); + } + +} diff --git a/ruoyi-common/ruoyi-common-forest/src/main/java/org/dromara/common/forest/utils/ForestUtils.java b/ruoyi-common/ruoyi-common-forest/src/main/java/org/dromara/common/forest/utils/ForestUtils.java new file mode 100644 index 000000000..21976ab9a --- /dev/null +++ b/ruoyi-common/ruoyi-common-forest/src/main/java/org/dromara/common/forest/utils/ForestUtils.java @@ -0,0 +1,34 @@ +package org.dromara.common.forest.utils; + +import org.dromara.common.core.utils.StringUtils; + +/** + * Forest第三方请求工具类 + * + * @author AprilWind + */ +public class ForestUtils { + + /** + * 生成参数片段 + * + * @param name 参数名 + * @param value 参数值 + * @return 带参数的URL片段,如果参数值为空,则返回空字符串 + */ + public static String parameter(String name, String value) { + return StringUtils.isNotBlank(value) ? "&" + name + "=" + value : ""; + } + + /** + * 生成参数片段 + * + * @param name 参数名称 + * @param value 参数值 + * @return 带参数的URL片段,如果参数值为空,则返回空字符串 + */ + public static String parameter(String name, Integer value) { + return value != null ? "&" + name + "=" + value : ""; + } + +} diff --git a/ruoyi-common/ruoyi-common-forest/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/ruoyi-common/ruoyi-common-forest/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 000000000..b7760e5ae --- /dev/null +++ b/ruoyi-common/ruoyi-common-forest/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +org.dromara.common.forest.config.ForestConfiguration diff --git a/ruoyi-common/ruoyi-common-forest/src/main/resources/common-forest.yml b/ruoyi-common/ruoyi-common-forest/src/main/resources/common-forest.yml new file mode 100644 index 000000000..009b2cc4c --- /dev/null +++ b/ruoyi-common/ruoyi-common-forest/src/main/resources/common-forest.yml @@ -0,0 +1,38 @@ +# 内置配置 +# HTTP 客户端配置 +forest: + # 支持okhttp3和httpclient两种后端 HTTP API(默认为 okhttp3) + backend: okhttp3 + # 连接池最大连接数(默认为 500) + max-connections: 1000 + # 每个路由的最大连接数(默认为 500) + max-route-connections: 500 + # 最大请求等待队列大小 + max-request-queue-size: 100 + # 最大异步线程数 + max-async-thread-size: 300 + # 最大异步线程池队列大小 + max-async-queue-size: 16 + # 请求超时时间,单位为毫秒(默认为 3000) + timeout: 3000 + # 连接超时时间,单位为毫秒(默认为 timeout) + connect-timeout: 300000 + # 数据读取超时时间,单位为毫秒(默认为 timeout) + read-timeout: 300000 + # 请求失败后重试次数(默认为 0 次不重试) + max-retry-count: 0 + # 单向验证的HTTPS的默认TLS协议(默认为 TLS) + ssl-protocol: TLS + # 打开或关闭日志(默认为 true) + log-enabled: false + # 打开/关闭Forest请求日志(默认为 true) + log-request: false + # 打开/关闭Forest响应状态日志(默认为 true) + log-response-status: false + # 打开/关闭Forest响应内容日志(默认为 false) + log-response-content: false + # 异步模式(默认为 platform) + async-mode: platform + # 在spring上下文中bean的id,默认值为forestConfiguration,可以在 Spring 中通过 Bean 的名称引用 + # ForestConfiguration forestConfiguration= SpringUtils.getBean("forestConfiguration"); + bean-id: forestConfiguration From 95ddcde9e042cf8d4f978d055709a2c49cc60d75 Mon Sep 17 00:00:00 2001 From: AprilWind <2100166581@qq.com> Date: Fri, 31 May 2024 16:06:55 +0800 Subject: [PATCH 2/4] =?UTF-8?q?update=20=E4=BF=AE=E5=A4=8Dforest=E5=BC=95?= =?UTF-8?q?=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index f01461858..31a0291ca 100644 --- a/pom.xml +++ b/pom.xml @@ -57,7 +57,8 @@ 3.11.0 3.1.2 1.3.0 - + + 1.5.36 7.0.0 @@ -386,6 +387,7 @@ ruoyi-common ruoyi-extend ruoyi-modules + ruoyi-client pom From 1cc00622586ee3eb67eaadc567aaf05af1f752b5 Mon Sep 17 00:00:00 2001 From: AprilWind <2100166581@qq.com> Date: Fri, 31 May 2024 16:10:33 +0800 Subject: [PATCH 3/4] =?UTF-8?q?add=20=E5=A2=9E=E5=8A=A0=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application-dev.yml | 10 + ruoyi-client/pom.xml | 25 + ruoyi-client/ruoyi-client-bom/pom.xml | 41 + ruoyi-client/ruoyi-client-demo/pom.xml | 32 + .../dromara/demo/client/ThdahhrfsClient.java | 29 + .../demo/client/ThdahhrfsIntercepto.java | 129 ++ .../org/dromara/demo/client/gd/GdClient.java | 66 + .../dromara/demo/client/gd/GdInterceptor.java | 34 + .../org/dromara/demo/client/gd/GdUtil.java | 235 ++++ .../dromara/demo/client/gd/vo/DistanceVo.java | 41 + .../org/dromara/demo/client/gd/vo/GeoVO.java | 105 ++ .../org/dromara/demo/client/gd/vo/IPVO.java | 36 + .../dromara/demo/client/gd/vo/RegeoVO.java | 159 +++ .../dromara/demo/client/gd/vo/Weather.java | 71 ++ .../demo/config/ThdahhrfsProperties.java | 27 + .../dromara/demo/domain/ThdahhrfsResult.java | 40 + .../org/dromara/demo/util/ThdahhrfsUtil.java | 36 + ...ot.autoconfigure.AutoConfiguration.imports | 1 + .../src/main/resources/client-demo.yml | 16 + ruoyi-client/ruoyi-client-guide/pom.xml | 27 + .../org/dromara/guide/client/GuideClient.java | 1122 +++++++++++++++++ .../dromara/guide/client/GuideIntercepto.java | 28 + .../guide/client/GuideTrafficClient.java | 28 + .../guide/client/GuideTrafficIntercepto.java | 33 + .../org/dromara/guide/domain/GuideEntity.java | 44 + .../dromara/guide/domain/GuideErrEntity.java | 39 + .../dromara/guide/domain/bo/DrivingBo.java | 52 + .../dromara/guide/domain/vo/BicyclingVo.java | 131 ++ .../org/dromara/guide/domain/vo/CircleVo.java | 139 ++ .../domain/vo/CoordinateConversionVo.java | 23 + .../dromara/guide/domain/vo/DistanceVo.java | 68 + .../dromara/guide/domain/vo/DistrictVo.java | 100 ++ .../dromara/guide/domain/vo/DrivingV3Vo.java | 211 ++++ .../dromara/guide/domain/vo/DrivingV4Vo.java | 192 +++ .../dromara/guide/domain/vo/DrivingVo.java | 64 + .../dromara/guide/domain/vo/GeocodeVo.java | 94 ++ .../org/dromara/guide/domain/vo/GeohubVo.java | 84 ++ .../dromara/guide/domain/vo/InputtipsVo.java | 71 ++ .../dromara/guide/domain/vo/IntegratedVo.java | 526 ++++++++ .../dromara/guide/domain/vo/IpLocationVo.java | 41 + .../org/dromara/guide/domain/vo/LineidVo.java | 189 +++ .../dromara/guide/domain/vo/LinenameVo.java | 74 ++ .../dromara/guide/domain/vo/PolylineVo.java | 112 ++ .../dromara/guide/domain/vo/Position2Vo.java | 125 ++ .../dromara/guide/domain/vo/PositionVo.java | 107 ++ .../dromara/guide/domain/vo/RectangleVo.java | 150 +++ .../guide/domain/vo/ReverseGeocodingVo.java | 468 +++++++ .../org/dromara/guide/domain/vo/RoadVo.java | 127 ++ .../org/dromara/guide/domain/vo/StopidVo.java | 107 ++ .../org/dromara/guide/domain/vo/TextVo.java | 421 +++++++ .../dromara/guide/domain/vo/TrafficVo.java | 135 ++ .../dromara/guide/domain/vo/WalkingVo.java | 183 +++ .../guide/domain/vo/WeatherQueryVo.java | 201 +++ .../org/dromara/guide/util/GuideUtil.java | 15 + ...ot.autoconfigure.AutoConfiguration.imports | 1 + .../src/main/resources/client-guide.yml | 5 + 56 files changed, 6670 insertions(+) create mode 100644 ruoyi-client/pom.xml create mode 100644 ruoyi-client/ruoyi-client-bom/pom.xml create mode 100644 ruoyi-client/ruoyi-client-demo/pom.xml create mode 100644 ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/client/ThdahhrfsClient.java create mode 100644 ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/client/ThdahhrfsIntercepto.java create mode 100644 ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/client/gd/GdClient.java create mode 100644 ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/client/gd/GdInterceptor.java create mode 100644 ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/client/gd/GdUtil.java create mode 100644 ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/client/gd/vo/DistanceVo.java create mode 100644 ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/client/gd/vo/GeoVO.java create mode 100644 ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/client/gd/vo/IPVO.java create mode 100644 ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/client/gd/vo/RegeoVO.java create mode 100644 ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/client/gd/vo/Weather.java create mode 100644 ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/config/ThdahhrfsProperties.java create mode 100644 ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/domain/ThdahhrfsResult.java create mode 100644 ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/util/ThdahhrfsUtil.java create mode 100644 ruoyi-client/ruoyi-client-demo/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports create mode 100644 ruoyi-client/ruoyi-client-demo/src/main/resources/client-demo.yml create mode 100644 ruoyi-client/ruoyi-client-guide/pom.xml create mode 100644 ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/client/GuideClient.java create mode 100644 ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/client/GuideIntercepto.java create mode 100644 ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/client/GuideTrafficClient.java create mode 100644 ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/client/GuideTrafficIntercepto.java create mode 100644 ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/GuideEntity.java create mode 100644 ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/GuideErrEntity.java create mode 100644 ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/bo/DrivingBo.java create mode 100644 ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/BicyclingVo.java create mode 100644 ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/CircleVo.java create mode 100644 ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/CoordinateConversionVo.java create mode 100644 ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/DistanceVo.java create mode 100644 ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/DistrictVo.java create mode 100644 ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/DrivingV3Vo.java create mode 100644 ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/DrivingV4Vo.java create mode 100644 ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/DrivingVo.java create mode 100644 ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/GeocodeVo.java create mode 100644 ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/GeohubVo.java create mode 100644 ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/InputtipsVo.java create mode 100644 ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/IntegratedVo.java create mode 100644 ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/IpLocationVo.java create mode 100644 ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/LineidVo.java create mode 100644 ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/LinenameVo.java create mode 100644 ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/PolylineVo.java create mode 100644 ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/Position2Vo.java create mode 100644 ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/PositionVo.java create mode 100644 ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/RectangleVo.java create mode 100644 ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/ReverseGeocodingVo.java create mode 100644 ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/RoadVo.java create mode 100644 ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/StopidVo.java create mode 100644 ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/TextVo.java create mode 100644 ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/TrafficVo.java create mode 100644 ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/WalkingVo.java create mode 100644 ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/WeatherQueryVo.java create mode 100644 ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/util/GuideUtil.java create mode 100644 ruoyi-client/ruoyi-client-guide/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports create mode 100644 ruoyi-client/ruoyi-client-guide/src/main/resources/client-guide.yml diff --git a/ruoyi-admin/src/main/resources/application-dev.yml b/ruoyi-admin/src/main/resources/application-dev.yml index 529a106bd..fea142d32 100644 --- a/ruoyi-admin/src/main/resources/application-dev.yml +++ b/ruoyi-admin/src/main/resources/application-dev.yml @@ -21,6 +21,16 @@ snail-job: # 详见 script/sql/snail_job.sql `sj_namespace` 表 namespace: ${spring.profiles.active} +--- # 第三方请求 +forest: + # 打开或关闭日志(默认为 true) + log-enabled: true + # 打开/关闭Forest请求日志(默认为 true) + log-request: true + # 打开/关闭Forest响应状态日志(默认为 true) + log-response-status: true + # 打开/关闭Forest响应内容日志(默认为 false) + log-response-content: true --- # 数据源配置 spring: diff --git a/ruoyi-client/pom.xml b/ruoyi-client/pom.xml new file mode 100644 index 000000000..fa0be6a1a --- /dev/null +++ b/ruoyi-client/pom.xml @@ -0,0 +1,25 @@ + + + + ruoyi-vue-plus + org.dromara + ${revision} + + 4.0.0 + + + ruoyi-client-bom + ruoyi-client-demo + ruoyi-client-guide + + + ruoyi-client + pom + + + ruoyi-client 客户端模块 + + + diff --git a/ruoyi-client/ruoyi-client-bom/pom.xml b/ruoyi-client/ruoyi-client-bom/pom.xml new file mode 100644 index 000000000..6155618a9 --- /dev/null +++ b/ruoyi-client/ruoyi-client-bom/pom.xml @@ -0,0 +1,41 @@ + + + 4.0.0 + + org.dromara + ruoyi-client-bom + ${revision} + pom + + + ruoyi-client-bom client 依赖项 + + + + 5.1.2 + + + + + + + + org.dromara + ruoyi-client-demo + ${revision} + + + + + org.dromara + ruoyi-client-guide + ${revision} + + + + + + + diff --git a/ruoyi-client/ruoyi-client-demo/pom.xml b/ruoyi-client/ruoyi-client-demo/pom.xml new file mode 100644 index 000000000..bd62f2ac8 --- /dev/null +++ b/ruoyi-client/ruoyi-client-demo/pom.xml @@ -0,0 +1,32 @@ + + + + org.dromara + ruoyi-client + ${revision} + + 4.0.0 + + ruoyi-client-demo + + + ruoyi-client-demo demo第三方请求服务示例 + + + + + + org.dromara + ruoyi-common-forest + + + + cn.hutool + hutool-crypto + + + + + diff --git a/ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/client/ThdahhrfsClient.java b/ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/client/ThdahhrfsClient.java new file mode 100644 index 000000000..2fa7f030a --- /dev/null +++ b/ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/client/ThdahhrfsClient.java @@ -0,0 +1,29 @@ +package org.dromara.demo.client; + +import com.dtflys.forest.annotation.BaseRequest; +import com.dtflys.forest.annotation.JSONBody; +import com.dtflys.forest.annotation.Post; +import com.dtflys.forest.http.ForestResponse; + +/** + * demo第三方请求服务 + */ +@BaseRequest(baseURL = "{thdahhrfs.ip}/fcj_zlf_caps_api", + contentType = "application/json", + charset = "UTF-8", + interceptor = ThdahhrfsIntercepto.class +) +public interface ThdahhrfsClient { + + /** + * 企业信息验证接口 + * + * @param companyName 企业名称 + * @param organizationCode 社会统一信用代码 + * @return 返回报文 + */ + @Post(url = "/bank/ValidateEnterpriseInfo") + ForestResponse validateEnterpriselnfo(@JSONBody("CompanyName") String companyName, + @JSONBody("OrganizationCode") String organizationCode); + +} diff --git a/ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/client/ThdahhrfsIntercepto.java b/ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/client/ThdahhrfsIntercepto.java new file mode 100644 index 000000000..0985e3eff --- /dev/null +++ b/ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/client/ThdahhrfsIntercepto.java @@ -0,0 +1,129 @@ +package org.dromara.demo.client; + +import cn.hutool.crypto.digest.DigestUtil; +import com.dtflys.forest.exceptions.ForestRuntimeException; +import com.dtflys.forest.http.ForestRequest; +import com.dtflys.forest.http.ForestRequestType; +import com.dtflys.forest.http.ForestResponse; +import com.dtflys.forest.interceptor.Interceptor; +import lombok.extern.slf4j.Slf4j; +import org.dromara.common.core.exception.ServiceException; +import org.dromara.common.core.utils.SpringUtils; +import org.dromara.common.json.utils.JsonUtils; +import org.dromara.demo.config.ThdahhrfsProperties; + +import java.util.HashMap; +import java.util.Map; +import java.util.TreeMap; + +/** + * 请求拦截 请求前添加key + * + * @author AprilWind + */ +@Slf4j +public class ThdahhrfsIntercepto implements Interceptor { + + public static final String TIMESTAMP = "Timestamp"; + public static final String APPID = "Appid"; + public static final String APP_SECRET = "AppSecret"; + public static final String U_KEY = "Ukey"; + public static final String SIGN = "Sign"; + private static final ThdahhrfsProperties THDAHHRFS = SpringUtils.getBean(ThdahhrfsProperties.class); + private static String IP = SpringUtils.getProperty("forest.variables.thdahhrfs.ip"); + /** + * 该方法在请求发送之前被调用, 若返回false则不会继续发送请求 + */ + @Override + public boolean beforeExecute(ForestRequest req) { + // 取值:unix时间戳 + long timestamp = System.currentTimeMillis(); + String appid = THDAHHRFS.getAppid(); + // 对AppSecret加密后的字符串 + String appSecret = THDAHHRFS.getAppSecret(); + // 对Appid进行MD5加密生成32位的字符串 + String uKey = DigestUtil.md5Hex(appid); + + req.addHeader(TIMESTAMP, timestamp); + req.addHeader(APPID, appid); + req.addHeader(APP_SECRET, appSecret); + req.addHeader(U_KEY, uKey); + + String signString = ""; + if (ForestRequestType.POST == req.getType() || ForestRequestType.GET == req.getType()) { + //添加请求参数到签名字符串中 + Map signData = new HashMap<>(); + if(ForestRequestType.POST == req.getType()){ + //按照键的Unicode码点排序 + String body = sortJsonByKey(JsonUtils.parseObject(req.body().encodeToString(), Map.class)); + req.body().clear(); + req.addBody(body); + signData.put("DATA", body); + }else if(ForestRequestType.GET == req.getType()){ + for (String key:req.getQuery().keySet()){ + signData.put(key.toUpperCase(),req.getQuery(key)); + } + } + signData.put("URL", "{URL}"); + signData.put(TIMESTAMP.toUpperCase(), String.valueOf(timestamp)); + signData.put(APPID.toUpperCase(), appid); + signData.put(U_KEY.toUpperCase(), uKey); + signString = sortJsonByKey(signData).replace("{URL}", req.getUrl().replace(IP, "")) + .replace("\\\\\\", "\\\\"); + log.info("--------------签名字符串未加密前信息---------------:{}", signString); + } + //通过MD5计算得到的32位hash值后,并转16进制且对结果转大写生成的字符串 + req.addHeader(SIGN, DigestUtil.md5Hex(signString).toUpperCase()); + return true; + } + + //@Override + //public void afterExecute(ForestRequest request, ForestResponse response) { + // Interceptor.super.afterExecute(request, response); + //} + + /** + * 该方法在请求成功响应时被调用 + */ + @Override + public void afterExecute(ForestRequest request, ForestResponse res) { + if (res.getStatusCode() != 200) { + throw new ServiceException("HTTP响应状态码:" + res.getStatusCode()); + } + // 解析响应体为Map对象 + Map result = JsonUtils.parseObject(res.getContent(), Map.class); + // 检查是否缺少 'code' 字段 + if (!result.containsKey("code")) { + throw new ServiceException("获取请求体失败:缺少 'code' 字段"); + } + // 获取 'code' 字段的值并转换为整数 + int code = (int) result.get("code"); + // 检查是否缺少 'data' 字段 + if (!result.containsKey("data")) { + throw new ServiceException("获取请求体失败:缺少 'data' 字段"); + } + // 如果 'code' 不等于 200,抛出异常 + if (code != 200) { + String errorMsg = result.containsKey("msg") ? result.get("msg").toString() : "未知错误"; + throw new ServiceException(errorMsg); + } + // 将 'data' 字段的值设置为结果 + res.setResult(JsonUtils.toJsonString(result.get("data"))); + } + + /** + * 该方法在请求发送失败时被调用 + */ + @Override + public void onError(ForestRuntimeException ex, ForestRequest req, ForestResponse res) { + throw new ServiceException("HTTP响应状态码:" + res.getStatusCode()); + } + + /** + * 按照键的Unicode码点排序 + */ + private static String sortJsonByKey(Map map) { + return JsonUtils.toJsonString((new TreeMap<>(map))); + } + +} diff --git a/ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/client/gd/GdClient.java b/ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/client/gd/GdClient.java new file mode 100644 index 000000000..39bab9a98 --- /dev/null +++ b/ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/client/gd/GdClient.java @@ -0,0 +1,66 @@ +package org.dromara.demo.client.gd; + +import cn.hutool.core.util.CoordinateUtil; +import com.dtflys.forest.annotation.BaseRequest; +import com.dtflys.forest.annotation.Get; +import com.dtflys.forest.annotation.Query; +import com.dtflys.forest.annotation.Var; +import org.dromara.demo.client.gd.vo.*; + +/** + * 高德请求工具 + * + * @author bkywksj + */ +@BaseRequest(baseURL = "https://restapi.amap.com", interceptor = GdInterceptor.class) +public interface GdClient { + + + /** + * 根据ip获取ip信息 + * + * @param ip ip地址 + * @param type 4代表ipv4 + * @return 地址信息 + */ + @Get(url = "/v3/ip") + IPVO getLocationByIp(@Query("ip") String ip, @Query("type") String type); + + /** + * 根据位置获取经纬度信息 地理编码 + * + * @param address 位置 + * @return 地理解析返回对象 + */ + @Get(url = "/v3/geocode/geo?output=json") + GeoVO geo(@Query("address") String address); + + /** + * 根据经纬度获取位置等信息 地理逆编码 + * + * @param coord 经纬度 + * @return 地理解析返回对象 + */ + @Get(url = "/v3/geocode/regeo?output=json&location=${coord.lng},${coord.lat}") + RegeoVO regeo(@Var("coord") CoordinateUtil.Coordinate coord); + + /** + * 根据位置获取经纬度信息 地理编码 + * + * @param adcode adcode + * @return 地理解析返回对象 + */ + @Get(url = "/v3/weather/weatherInfo") + Weather getWeatherByAdcode(@Query("city") String adcode); + + /** + * 根据位置获取经纬度信息 地理编码 + * + * @param start 起始经纬度 + * @param end 终止经纬度 + * @return 距离信息 + */ + @Get(url = "/v3/distance?type=0&origins=${origins.lng},${origins.lat}&destination=${destination.lng},${destination.lat}") + DistanceVo getDistance(@Var("origins") CoordinateUtil.Coordinate start, @Query("destination") CoordinateUtil.Coordinate end); + +} diff --git a/ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/client/gd/GdInterceptor.java b/ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/client/gd/GdInterceptor.java new file mode 100644 index 000000000..61d98b750 --- /dev/null +++ b/ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/client/gd/GdInterceptor.java @@ -0,0 +1,34 @@ +package org.dromara.demo.client.gd; + +import com.dtflys.forest.http.ForestRequest; +import com.dtflys.forest.interceptor.Interceptor; +import lombok.extern.slf4j.Slf4j; + +/** + * 请求拦截 请求前添加key + * + * @author ye + */ +@Slf4j +public class GdInterceptor implements Interceptor { + + /** + * 密钥 xxxxxxxxxxxxxxxxxxxxxx + */ + private static final String KEY = "xxxxxxxxxxxxxxxxxxx"; + + + /** + * 该方法在请求发送之前被调用, 若返回false则不会继续发送请求 + * + * @param req Forest请求对象 + */ + @Override + public boolean beforeExecute(ForestRequest req) { + // 添加URL的Query参数 + req.addQuery("key", KEY); + // 继续执行请求返回true + return true; + } + +} diff --git a/ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/client/gd/GdUtil.java b/ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/client/gd/GdUtil.java new file mode 100644 index 000000000..952771a22 --- /dev/null +++ b/ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/client/gd/GdUtil.java @@ -0,0 +1,235 @@ +package org.dromara.demo.client.gd; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.CoordinateUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import com.dtflys.forest.config.ForestConfiguration; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import org.dromara.common.core.utils.SpringUtils; +import org.dromara.common.core.utils.StringUtils; +import org.dromara.demo.client.gd.vo.*; + +import java.util.List; + +/** + * 高德地图API + * + * @author ye + */ +public class GdUtil { + + private static GdClient CLIENT; + + static { + try { + CLIENT = SpringUtils.getBean(GdClient.class); + } catch (Exception ignored) { + } + //在springboot容器中拿不到就创建一个 + if (ObjectUtil.isNull(CLIENT)) { + //创建默认forest配置,创建一个GdClient实例 + CLIENT = ForestConfiguration.createConfiguration().createInstance(GdClient.class); + } + } + + /** + * 根据位置获取经纬度等信息 地理编码 + * + * @param address 位置 + * @return 经纬度等信息 + */ + public static GeoVO geo(String address) { + return CLIENT.geo(address); + } + + /** + * 根据位置获取经纬度 + * + * @param address 位置 + * @return 经纬度 + */ + public static CoordinateUtil.Coordinate getLocationByAddress(String address) { + GeoVO geo = CLIENT.geo(address); + //要进行非空判断 + if (ObjectUtil.isNull(geo)) { + return null; + } + List geocodes = geo.getGeocodes(); + if (geocodes.isEmpty()) { + return null; + } + String location = geocodes.get(0).getLocation(); + String[] split = location.split(","); + if (split.length != 2) { + return null; + } + return new CoordinateUtil.Coordinate(Double.parseDouble(split[0]), Double.parseDouble(split[1])); + } + + /** + * 根据经纬度获取位置等信息 地理逆编码 + * + * @param coord 经纬度 + * @return 地理解析返回对象 + */ + public static RegeoVO regeo(CoordinateUtil.Coordinate coord) { + if (ObjectUtil.isNull(coord.getLng()) || ObjectUtil.isNull(coord.getLat())) { + return null; + } + return CLIENT.regeo(coord); + } + + /** + * 根据经纬度获取具体位置 地理逆编码 + * + * @param coord 经纬度 + * @return 地址 + */ + public static String getAddressByCoord(CoordinateUtil.Coordinate coord) { + RegeoVO regeo = regeo(coord); + if (ObjectUtil.isNull(regeo)) { + return null; + } + RegeoVO.RegeocodeDTO regeocode = regeo.getRegeocode(); + if (ObjectUtil.isNull(regeocode)) { + return null; + } + return regeocode.getFormattedAddress(); + } + + /** + * 根据经纬度获取adcode + * + * @param coord 经纬度 + * @return adcode + */ + public static String getAdcodeByCoord(CoordinateUtil.Coordinate coord) { + RegeoVO regeo = regeo(coord); + if (ObjectUtil.isNull(regeo)) { + return null; + } + RegeoVO.RegeocodeDTO regeocode = regeo.getRegeocode(); + if (ObjectUtil.isNull(regeocode)) { + return null; + } + RegeoVO.RegeocodeDTO.AddressComponentDTO addressComponent = regeocode.getAddressComponent(); + if (ObjectUtil.isNull(addressComponent)) { + return null; + } + return addressComponent.getAdcode(); + } + + /** + * 根据位置获取adcode + * + * @param address 位置 + * @return adcode + */ + public static String getAdcodeByAddress(String address) { + GeoVO geo = geo(address); + if (geo == null) { + return null; + } + List geocodes = geo.getGeocodes(); + if (CollUtil.isEmpty(geocodes)) { + return null; + } + return geocodes.get(0).getAdcode(); + } + + /** + * 根据adcode获取天气等信息 + * + * @param adcode adcode + * @return 天气 + */ + public static Weather.LivesDTO getWeatherByAdcode(@NotBlank String adcode) { + Weather weather = CLIENT.getWeatherByAdcode(adcode); + if (ObjectUtil.isNull(weather)) { + return null; + } + List lives = weather.getLives(); + if (CollUtil.isEmpty(lives)) { + return null; + } + return lives.get(0); + } + + /** + * 根据经纬度获取天气 + * + * @param coord 经纬度 + * @return 天气 + */ + public static Weather.LivesDTO getWeatherByCoord(CoordinateUtil.Coordinate coord) { + String adcode = getAdcodeByCoord(coord); + if (StringUtils.isBlank(adcode)) { + return null; + } + return getWeatherByAdcode(adcode); + } + + /** + * 根据位置获取天气 + * + * @param address 位置 + * @return 天气 + */ + public static Weather.LivesDTO getWeatherByAddress(String address) { + String adcode = getAdcodeByAddress(address); + if (StrUtil.isEmpty(adcode)) { + return null; + } + return getWeatherByAdcode(adcode); + } + + /** + * 根据ip获取ip信息 + * + * @param ip ip地址 + * @param type 4代表ipv4 + * @return 地址信息 + */ + public static IPVO getLocationByIp(@NotBlank String ip, @NotBlank String type) { + return CLIENT.getLocationByIp(ip, type); + } + + /** + * 根据ip获取地址 + * + * @param ip ip地址 + * @param type 4代表ipv4 + * @return 地址信息 + */ + public static String getAddressByIp(String ip, String type) { + IPVO ipvo = getLocationByIp(ip, type); + if (ObjectUtil.isNull(ipvo)) { + return null; + } + String location = ipvo.getLocation(); + String[] split = location.split(","); + if (split.length != 2) { + return null; + } + CoordinateUtil.Coordinate coord = new CoordinateUtil.Coordinate(Double.parseDouble(split[0]), Double.parseDouble(split[1])); + return getAddressByCoord(coord); + } + + /** + * 获取起点和终点经纬度距离 + * + * @param start 起点 + * @param end 终点 + */ + public static Long getDistance(@NotNull CoordinateUtil.Coordinate start, @NotNull CoordinateUtil.Coordinate end) { + DistanceVo distanceVo = CLIENT.getDistance(start, end); + List results = distanceVo.getResults(); + if (CollUtil.isEmpty(results)) { + return null; + } + DistanceVo.ResultsDTO resultsDTO = results.get(0); + return Long.valueOf(resultsDTO.getDistance()); + } +} diff --git a/ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/client/gd/vo/DistanceVo.java b/ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/client/gd/vo/DistanceVo.java new file mode 100644 index 000000000..072aa0e44 --- /dev/null +++ b/ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/client/gd/vo/DistanceVo.java @@ -0,0 +1,41 @@ +package org.dromara.demo.client.gd.vo; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +/** + * 距离信息 + * + * @author ye + */ +@NoArgsConstructor +@Data +public class DistanceVo { + + @JsonProperty("status") + private String status; + @JsonProperty("info") + private String info; + @JsonProperty("infocode") + private String infocode; + @JsonProperty("count") + private String count; + @JsonProperty("results") + private List results; + + @NoArgsConstructor + @Data + public static class ResultsDTO { + @JsonProperty("origin_id") + private String originId; + @JsonProperty("dest_id") + private String destId; + @JsonProperty("distance") + private String distance; + @JsonProperty("duration") + private String duration; + } +} diff --git a/ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/client/gd/vo/GeoVO.java b/ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/client/gd/vo/GeoVO.java new file mode 100644 index 000000000..6ca490040 --- /dev/null +++ b/ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/client/gd/vo/GeoVO.java @@ -0,0 +1,105 @@ +package org.dromara.demo.client.gd.vo; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +/** + * 地理解析返回对象 + * + * @author ye + */ +@NoArgsConstructor +@Data +public class GeoVO { + + + /** + * status : 1 + * info : OK + * infocode : 10000 + * count : 1 + * geocodes : [{"formatted_address":"北京市朝阳区阜通东大街|6号","country":"中国","province":"北京市","citycode":"010","city":"北京市","district":"朝阳区","township":[],"neighborhood":{"name":[],"type":[]},"building":{"name":[],"type":[]},"adcode":"110105","street":"阜通东大街","number":"6号","location":"116.483038,39.990633","level":"门牌号"}] + */ + + @JsonProperty("status") + private String status; + @JsonProperty("info") + private String info; + @JsonProperty("infocode") + private String infocode; + @JsonProperty("count") + private String count; + @JsonProperty("geocodes") + private List geocodes; + + @NoArgsConstructor + @Data + public static class GeocodesDTO { + /** + * formatted_address : 北京市朝阳区阜通东大街|6号 + * country : 中国 + * province : 北京市 + * citycode : 010 + * city : 北京市 + * district : 朝阳区 + * township : [] + * neighborhood : {"name":[],"type":[]} + * building : {"name":[],"type":[]} + * adcode : 110105 + * street : 阜通东大街 + * number : 6号 + * location : 116.483038,39.990633 + * level : 门牌号 + */ + + @JsonProperty("formatted_address") + private String formattedAddress; + @JsonProperty("country") + private String country; + @JsonProperty("province") + private String province; + @JsonProperty("citycode") + private String citycode; + @JsonProperty("city") + private String city; + @JsonProperty("district") + private String district; + @JsonProperty("township") + private List township; + @JsonProperty("neighborhood") + private NeighborhoodDTO neighborhood; + @JsonProperty("building") + private BuildingDTO building; + @JsonProperty("adcode") + private String adcode; + @JsonProperty("street") + private String street; + @JsonProperty("number") + private String number; + @JsonProperty("location") + private String location; + @JsonProperty("level") + private String level; + + @NoArgsConstructor + @Data + public static class NeighborhoodDTO { + @JsonProperty("name") + private List name; + @JsonProperty("type") + private List type; + } + + @NoArgsConstructor + @Data + public static class BuildingDTO { + @JsonProperty("name") + private List name; + @JsonProperty("type") + private List type; + } + } +} diff --git a/ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/client/gd/vo/IPVO.java b/ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/client/gd/vo/IPVO.java new file mode 100644 index 000000000..5ddb024d2 --- /dev/null +++ b/ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/client/gd/vo/IPVO.java @@ -0,0 +1,36 @@ +package org.dromara.demo.client.gd.vo; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * ip获取位置传输对象 + * + * @author ye + */ +@NoArgsConstructor +@Data +public class IPVO { + + @JsonProperty("status") + private String status; + @JsonProperty("info") + private String info; + @JsonProperty("infocode") + private String infocode; + @JsonProperty("country") + private String country; + @JsonProperty("province") + private String province; + @JsonProperty("city") + private String city; + @JsonProperty("district") + private String district; + @JsonProperty("isp") + private String isp; + @JsonProperty("location") + private String location; + @JsonProperty("ip") + private String ip; +} diff --git a/ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/client/gd/vo/RegeoVO.java b/ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/client/gd/vo/RegeoVO.java new file mode 100644 index 000000000..22c25c8fa --- /dev/null +++ b/ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/client/gd/vo/RegeoVO.java @@ -0,0 +1,159 @@ +package org.dromara.demo.client.gd.vo; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +/** + * 逆地理返回传输对象 + * + * @author ye + */ +@NoArgsConstructor +@Data +public class RegeoVO { + + /** + * status : 1 + * regeocode : {"addressComponent":{"city":[],"province":"北京市","adcode":"110108","district":"海淀区","towncode":"110108015000","streetNumber":{"number":"5号","location":"116.310454,39.992734","direction":"东北","distance":"94.5489","street":"颐和园路"},"country":"中国","township":"燕园街道","businessAreas":[{"location":"116.303364,39.976410","name":"万泉河","id":"110108"},{"location":"116.314222,39.982490","name":"中关村","id":"110108"},{"location":"116.294214,39.996850","name":"西苑","id":"110108"}],"building":{"name":"北京大学","type":"科教文化服务;学校;高等院校"},"neighborhood":{"name":"北京大学","type":"科教文化服务;学校;高等院校"},"citycode":"010"},"formatted_address":"北京市海淀区燕园街道北京大学"} + * info : OK + * infocode : 10000 + */ + + @JsonProperty("status") + private String status; + @JsonProperty("regeocode") + private RegeocodeDTO regeocode; + @JsonProperty("info") + private String info; + @JsonProperty("infocode") + private String infocode; + + @NoArgsConstructor + @Data + public static class RegeocodeDTO { + /** + * addressComponent : {"city":[],"province":"北京市","adcode":"110108","district":"海淀区","towncode":"110108015000","streetNumber":{"number":"5号","location":"116.310454,39.992734","direction":"东北","distance":"94.5489","street":"颐和园路"},"country":"中国","township":"燕园街道","businessAreas":[{"location":"116.303364,39.976410","name":"万泉河","id":"110108"},{"location":"116.314222,39.982490","name":"中关村","id":"110108"},{"location":"116.294214,39.996850","name":"西苑","id":"110108"}],"building":{"name":"北京大学","type":"科教文化服务;学校;高等院校"},"neighborhood":{"name":"北京大学","type":"科教文化服务;学校;高等院校"},"citycode":"010"} + * formatted_address : 北京市海淀区燕园街道北京大学 + */ + + @JsonProperty("addressComponent") + private AddressComponentDTO addressComponent; + @JsonProperty("formatted_address") + private String formattedAddress; + + @NoArgsConstructor + @Data + public static class AddressComponentDTO { + /** + * city : [] + * province : 北京市 + * adcode : 110108 + * district : 海淀区 + * towncode : 110108015000 + * streetNumber : {"number":"5号","location":"116.310454,39.992734","direction":"东北","distance":"94.5489","street":"颐和园路"} + * country : 中国 + * township : 燕园街道 + * businessAreas : [{"location":"116.303364,39.976410","name":"万泉河","id":"110108"},{"location":"116.314222,39.982490","name":"中关村","id":"110108"},{"location":"116.294214,39.996850","name":"西苑","id":"110108"}] + * building : {"name":"北京大学","type":"科教文化服务;学校;高等院校"} + * neighborhood : {"name":"北京大学","type":"科教文化服务;学校;高等院校"} + * citycode : 010 + */ + + @JsonProperty("city") + private List city; + @JsonProperty("province") + private String province; + @JsonProperty("adcode") + private String adcode; + @JsonProperty("district") + private String district; + @JsonProperty("towncode") + private String towncode; + @JsonProperty("streetNumber") + private StreetNumberDTO streetNumber; + @JsonProperty("country") + private String country; + @JsonProperty("township") + private String township; + @JsonProperty("businessAreas") + private List businessAreas; + @JsonProperty("building") + private BuildingDTO building; + @JsonProperty("neighborhood") + private NeighborhoodDTO neighborhood; + @JsonProperty("citycode") + private String citycode; + + @NoArgsConstructor + @Data + public static class StreetNumberDTO { + /** + * number : 5号 + * location : 116.310454,39.992734 + * direction : 东北 + * distance : 94.5489 + * street : 颐和园路 + */ + + @JsonProperty("number") + private String number; + @JsonProperty("location") + private String location; + @JsonProperty("direction") + private String direction; + @JsonProperty("distance") + private String distance; + @JsonProperty("street") + private String street; + } + + @NoArgsConstructor + @Data + public static class BuildingDTO { + /** + * name : 北京大学 + * type : 科教文化服务;学校;高等院校 + */ + + @JsonProperty("name") + private String name; + @JsonProperty("type") + private String type; + } + + @NoArgsConstructor + @Data + public static class NeighborhoodDTO { + /** + * name : 北京大学 + * type : 科教文化服务;学校;高等院校 + */ + + @JsonProperty("name") + private String name; + @JsonProperty("type") + private String type; + } + + @NoArgsConstructor + @Data + public static class BusinessAreasDTO { + /** + * location : 116.303364,39.976410 + * name : 万泉河 + * id : 110108 + */ + + @JsonProperty("location") + private String location; + @JsonProperty("name") + private String name; + @JsonProperty("id") + private String id; + } + } + } +} diff --git a/ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/client/gd/vo/Weather.java b/ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/client/gd/vo/Weather.java new file mode 100644 index 000000000..654326225 --- /dev/null +++ b/ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/client/gd/vo/Weather.java @@ -0,0 +1,71 @@ +package org.dromara.demo.client.gd.vo; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +/** + * 查询天气返回对象 + * + * @author ye + */ +@NoArgsConstructor +@Data +public class Weather { + + /** + * status : 1 + * count : 1 + * info : OK + * infocode : 10000 + * lives : [{"province":"北京","city":"朝阳区","adcode":"110105","weather":"阴","temperature":"32","winddirection":"西南","windpower":"4","humidity":"41","reporttime":"2021-05-22 15:34:11"}] + */ + + @JsonProperty("status") + private String status; + @JsonProperty("count") + private String count; + @JsonProperty("info") + private String info; + @JsonProperty("infocode") + private String infocode; + @JsonProperty("lives") + private List lives; + + @NoArgsConstructor + @Data + public static class LivesDTO { + /** + * province : 北京 + * city : 朝阳区 + * adcode : 110105 + * weather : 阴 + * temperature : 32 + * winddirection : 西南 + * windpower : 4 + * humidity : 41 + * reporttime : 2021-05-22 15:34:11 + */ + + @JsonProperty("province") + private String province; + @JsonProperty("city") + private String city; + @JsonProperty("adcode") + private String adcode; + @JsonProperty("weather") + private String weather; + @JsonProperty("temperature") + private String temperature; + @JsonProperty("winddirection") + private String winddirection; + @JsonProperty("windpower") + private String windpower; + @JsonProperty("humidity") + private String humidity; + @JsonProperty("reporttime") + private String reporttime; + } +} diff --git a/ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/config/ThdahhrfsProperties.java b/ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/config/ThdahhrfsProperties.java new file mode 100644 index 000000000..dd9f01d76 --- /dev/null +++ b/ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/config/ThdahhrfsProperties.java @@ -0,0 +1,27 @@ +package org.dromara.demo.config; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; + +@Data +@ConfigurationProperties(prefix = "client.thdahhrfs") +public class ThdahhrfsProperties { + + private String appid; + + /** + * 使用分配的Appid通过加密后生成 + */ + private String appSecret; + + /** + * SM2公钥 + */ + private String publicKey; + + /** + * SM2私钥 + */ + private String privateKey; + +} diff --git a/ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/domain/ThdahhrfsResult.java b/ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/domain/ThdahhrfsResult.java new file mode 100644 index 000000000..a8f70d43c --- /dev/null +++ b/ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/domain/ThdahhrfsResult.java @@ -0,0 +1,40 @@ +package org.dromara.demo.domain; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serial; +import java.io.Serializable; + +/** + * 企业信息验证接口 + * + * @author AprilWind + */ +@NoArgsConstructor +@Data +public class ThdahhrfsResult implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * true,false + */ + @JsonProperty("isSuccess") + private Boolean success; + + /** + * 异常信息 + */ + @JsonProperty("exception") + private String exception; + + /** + * 结果 + */ + @JsonProperty("result") + private String result; + +} diff --git a/ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/util/ThdahhrfsUtil.java b/ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/util/ThdahhrfsUtil.java new file mode 100644 index 000000000..310250fb1 --- /dev/null +++ b/ruoyi-client/ruoyi-client-demo/src/main/java/org/dromara/demo/util/ThdahhrfsUtil.java @@ -0,0 +1,36 @@ +package org.dromara.demo.util; + +import com.dtflys.forest.Forest; +import com.dtflys.forest.http.ForestResponse; +import org.dromara.common.core.utils.StringUtils; +import org.dromara.common.forest.exception.ForestException; +import org.dromara.common.json.utils.JsonUtils; +import org.dromara.demo.client.ThdahhrfsClient; +import org.dromara.demo.domain.ThdahhrfsResult; + +/** + * demo第三方请求服务请求工具 + */ +public class ThdahhrfsUtil { + private static ThdahhrfsClient CLIENT = Forest.client(ThdahhrfsClient.class); + + /** + * 企业信息验证接口 + * + * @param companyName 企业名称 + * @param organizationCode 社会统一信用代码 + * @return 返回报文 + */ + public static ThdahhrfsResult validateEnterpriselnfo(String companyName, String organizationCode) { + ForestResponse response = CLIENT.validateEnterpriselnfo(companyName, organizationCode); + if (!response.isSuccess()) { + throw new ForestException("请求第三方异常:" + response.getException()); + } + String result = response.getResult(); + if (StringUtils.isBlank(result)) { + return null; + } + return JsonUtils.parseObject(result, ThdahhrfsResult.class); + } + +} diff --git a/ruoyi-client/ruoyi-client-demo/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/ruoyi-client/ruoyi-client-demo/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 000000000..82b6074d6 --- /dev/null +++ b/ruoyi-client/ruoyi-client-demo/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +org.dromara.demo.config.ThdahhrfsProperties diff --git a/ruoyi-client/ruoyi-client-demo/src/main/resources/client-demo.yml b/ruoyi-client/ruoyi-client-demo/src/main/resources/client-demo.yml new file mode 100644 index 000000000..a92e8e988 --- /dev/null +++ b/ruoyi-client/ruoyi-client-demo/src/main/resources/client-demo.yml @@ -0,0 +1,16 @@ +forest: + # 全局变量 + variables: + # demo第三方请求服务 + thdahhrfs: + # 请求地址 + ip: http://zlzjapi.sanshi.yunsee.cn:8090 + +client: + # demo第三方请求服务 + thdahhrfs: + appid: 84fd3bb528549d07 + appSecret: Wpe/t9fkrpDux6cv5dx8h1JW4THCpLBop0USj+wSBUbj+oPJA+UhQPCu0nPxMTZUXDU3e9jk60WnkMIQDuUbSeBOVftnpqONu35afozxOpyg50BRR9phyajD0mcI/mFlfuh0GMGkMQG54qg4UDc1c7h2iCtTkfvGQUGR1jsrSCn1YOLiEqKBOkFDdw7eEMFYkIoXf1R3FScwxmAUdBK2LFAv67yhjEJyajLFur+oQVQ232oGXZbCfzP6Nw6JtymdNFMravd5q5E7bDfuGJWlObYQtiUyOpq9HH4Yn9YhRHgMppE6uVaYON/sGEiv375Nm6cA4qiXeiUiFBCyjkTaYw== + # SM2公私钥 非对称算法的公私钥 + publicKey: 049927d887e38ebd30d4418b5e5785f75014efaec36cc2dce9ce49bfad42d81c2d0b0b5bc360cc56d0f9d17d178d6cb091d8449adc3b57ab196f6d7ec61ffabcea + privateKey: fc4a50a91c25a85bfc8c6ab4c60005c986007afb9ccf9503afc880c4001f1803 diff --git a/ruoyi-client/ruoyi-client-guide/pom.xml b/ruoyi-client/ruoyi-client-guide/pom.xml new file mode 100644 index 000000000..ac30dc2e5 --- /dev/null +++ b/ruoyi-client/ruoyi-client-guide/pom.xml @@ -0,0 +1,27 @@ + + + + org.dromara + ruoyi-client + ${revision} + + 4.0.0 + + ruoyi-client-guide + + + ruoyi-client-guide 高德地图API + + + + + + org.dromara + ruoyi-common-forest + + + + + diff --git a/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/client/GuideClient.java b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/client/GuideClient.java new file mode 100644 index 000000000..348ec1772 --- /dev/null +++ b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/client/GuideClient.java @@ -0,0 +1,1122 @@ +package org.dromara.guide.client; + +import cn.hutool.core.util.CoordinateUtil; +import com.dtflys.forest.annotation.*; +import org.dromara.guide.domain.bo.DrivingBo; +import org.dromara.guide.domain.vo.*; + +import java.util.List; + +/** + * 高德地图API请求服务 + *

参考文档:GuideClient

+ * + * @author AprilWind + */ +@BaseRequest(baseURL = "https://restapi.amap.com", charset = "UTF-8", interceptor = GuideIntercepto.class) +public interface GuideClient { + + /** + * IP定位:将IPv4地址定位到具体地理位置,不支持国外IP解析 + * + * @param ip (必填)IPv4地址 + * @return 返回地理位置信息 + */ + @Get(url = "/v3/ip?output=json") + IpLocationVo getLocationByIpV3(@Query("ip") String ip); + + /** + * 地理编码:将详细的结构化地址转换为高德经纬度坐标,支持对地标性名胜景区、建筑物名称解析为高德经纬度坐标 + * + * @param address (必填)结构化地址信息,规则遵循:国家、省份、城市、区县、城镇、乡村、街道、门牌号码、屋村、大厦, + * 例如:北京市朝阳区阜通东大街6号。地标性建筑举例:天安门 + * @param city (可选)城市信息:可选输入内容包括:指定城市的中文(如北京)、指定城市的中文全拼(beijing)、citycode(010)、adcode(110000),不支持县级市。当指定城市查询内容为空时,会进行全国范围内的地址转换检索 + * @return 返回转换后的经纬度坐标,格式为"经度,纬度",例如:116.480881,39.989410 + */ + @Get(url = "/v3/geocode/geo?output=json" + "#{T(ForestUtils).parameter('city', #city)}") + GeocodeVo geoV3(@Query("address") String address, String city); + + /** + * 逆地理编码:将经纬度转换为详细结构化的地址,同时返回附近周边的POI、AOI信息 + * 例如:116.480881,39.989410 转换地址描述后:北京市朝阳区阜通东大街6号 + * + * @param location (必填)经纬度坐标,传入内容规则:经度在前,纬度在后,经纬度间以“,”分割,经纬度小数点后不要超过6位 + * @param poitype (可选)返回附近POI类型:以下内容需要 extensions 参数为 all 时才生效。 + *

+ * 逆地理编码在进行坐标解析之后不仅可以返回地址描述,也可以返回经纬度附近符合限定要求的POI内容(在 extensions 字段值为 all 时才会返回POI内容)。设置 POI 类型参数相当于为上述操作限定要求。参数仅支持传入POI TYPECODE,可以传入多个POI TYPECODE,相互之间用“|”分隔 + * @param radius (可选)搜索半径:radius取值范围在0~3000,默认是1000。单位:米 + * @param extensions (可选)返回结果控制:extensions 参数默认取值是 base,也就是返回基本地址信息; + *

+ * extensions 参数取值为 all 时会返回基本地址信息、附近 POI 内容、道路信息以及道路交叉口信息 + * @param roadlevel (可选)道路等级:以下内容需要 extensions 参数为 all 时才生效。 + *

+ * 可选值:0,1 + * 当roadlevel=0时,显示所有道路 + * 当roadlevel=1时,过滤非主干道路,仅输出主干道路数据 + * @param homeorcorp (可选)是否优化POI返回顺序:以下内容需要 extensions 参数为 all 时才生效。 + *

+ * homeorcorp 参数的设置可以影响召回 POI 内容的排序策略,目前提供三个可选参数: + *

+ * 0:不对召回的排序策略进行干扰。 + *

+ * 1:综合大数据分析将居家相关的 POI 内容优先返回,即优化返回结果中 pois 字段的poi顺序。 + *

+ * 2:综合大数据分析将公司相关的 POI 内容优先返回,即优化返回结果中 pois 字段的poi顺序。 + * @return 返回转换后的结构化地址和附近周边的POI、AOI信息 + */ + @Get(url = "/v3/geocode/regeo?output=json&location=${location.lng},${location.lat}" + + "#{T(ForestUtils).parameter('poitype', #poitype)}" + + "#{T(ForestUtils).parameter('radius', #radius)}" + + "#{T(ForestUtils).parameter('extensions', #extensions)}" + + "#{T(ForestUtils).parameter('roadlevel', #roadlevel)}" + + "#{T(ForestUtils).parameter('homeorcorp', #homeorcorp)}" + ) + ReverseGeocodingVo regeoV3(@Var("location") CoordinateUtil.Coordinate location, String poitype, String radius, String extensions, String roadlevel, String homeorcorp); + + /** + * 坐标转换:将用户输入的非高德坐标(GPS坐标、mapbar坐标、baidu坐标)转换成高德坐标 + * + * @param locations (必填)坐标点,包括经度和纬度 + * @param coordsys (可选)原坐标系:可选值: + *

+ * gps; + *

+ * mapbar; + *

+ * baidu; + *

+ * autonavi(不进行转换) + * @return 返回转换后的高德坐标 + */ + @Get(url = "/v3/assistant/coordinate/convert?output=json&locations=${locations.lng},${locations.lat}" + + "#{T(ForestUtils).parameter('coordsys', #coordsys)}" + ) + CoordinateConversionVo convertV3(@Var("locations") CoordinateUtil.Coordinate locations, String coordsys); + + /** + * 多个坐标转换:将用户输入的非高德坐标(GPS坐标、mapbar坐标、baidu坐标)转换成高德坐标 + * + * @param locations (必填)坐标点:经度和纬度用","分割,经度在前,纬度在后,经纬度小数点后不得超过6位。多个坐标对之间用”|”进行分隔最多支持40对坐标 + * @param coordsys (可选)原坐标系:可选值: + *

+ * gps; + *

+ * mapbar; + *

+ * baidu; + *

+ * autonavi(不进行转换) + * @return 返回转换后的高德坐标 + */ + @Get(url = "/v3/assistant/coordinate/convert?output=json" + "#{T(ForestUtils).parameter('coordsys', #coordsys)}") + CoordinateConversionVo convertV3(@Query("locations") String locations, String coordsys); + + /** + * 天气查询 + * + * @param city (必填)城市编码:输入城市的adcode + * @param extensions (可选)气象类型:可选值:base/all + *

+ * base:返回实况天气 + *

+ * all:返回预报天气 + * @return 实况天气每小时更新多次,预报天气每天更新3次,分别在8、11、18点左右更新。由于天气数据的特殊性以及数据更新的持续性,无法确定精确的更新时间,请以接口返回数据的reporttime字段为准 + */ + @Get(url = "/v3/weather/weatherInfo?output=json" + "#{T(ForestUtils).parameter('extensions', #extensions)}") + WeatherQueryVo weatherInfoV3(@Query("city") String city, String extensions); + + /** + * 距离测量 + * + * @param origins (必填)出发点坐标,最多支持100个坐标对,格式为经度和纬度用逗号分隔,多个坐标对之间用竖线分隔 + * @param destination (必填)目的地坐标,格式为经度和纬度用逗号分隔,如"117.500244,40.417801" + * @param type (可选)路径计算的方式和方法: + * 0:直线距离 + *

+ * 1:驾车导航距离(仅支持国内坐标)。 + *

+ * 必须指出,当为1时会考虑路况,故在不同时间请求返回结果可能不同。 + *

+ * 此策略和驾车路径规划接口的 strategy=4策略基本一致,策略为“ 躲避拥堵的路线,但是可能会存在绕路的情况,耗时可能较长 ” + *

+ * 若需要实现高德地图客户端效果,可以考虑使用驾车路径规划接口 + *

+ * 3:步行规划距离(仅支持5km之间的距离) + * @return 距离信息 + */ + @Get(url = "/v3/distance?output=json" + "#{T(ForestUtils).parameter('type', #type)}") + DistanceVo distanceV3(@Query("origins") String origins, @Query("destination") String destination, String type); + + /** + * 步行路径规划:步行路径规划 API 可以规划100KM以内的步行通勤方案,并且返回通勤方案的数据。最大支持 100km 的步行路线规划 + * + * @param origin (必填)出发点:规则: lon,lat(经度,纬度), “,”分割,如117.500244, 40.417801 经纬度小数点不超过6位 + * @param destination (必填)目的地:规则: lon,lat(经度,纬度), “,”分割,如117.500244, 40.417801 经纬度小数点不超过6位 + * @param originId (选填)起点POI ID:起点为POI时,建议填充此值,可提升路线规划准确性 + * @param destinationId (选填)目的地POI ID:目的地为POI时,建议填充此值,可提升路线规划准确性 + * @return + */ + @Get(url = "/v3/direction/walking?output=json&origin=${origin.lng},${origin.lat}&destination=${destination.lng},${destination.lat}" + + "#{T(ForestUtils).parameter('origin_id', #originId)}" + + "#{T(ForestUtils).parameter('destination_id', #destinationId)}" + ) + WalkingVo walkingV3(@Var("origin") CoordinateUtil.Coordinate origin, @Var("destination") CoordinateUtil.Coordinate destination, String originId, String destinationId); + + /** + * 公交路径规划:公交路径规划 API 可以规划综合各类公共(火车、公交、地铁)交通方式的通勤方案,并且返回通勤方案的数据 + * + * @param origin (必填)出发点:规则: lon,lat(经度,纬度), “,”分割,如117.500244, 40.417801 经纬度小数点不超过6位 + * @param destination (必填)目的地:规则: lon,lat(经度,纬度), “,”分割,如117.500244, 40.417801 经纬度小数点不超过6位 + * @param city (必填)城市/跨城规划时的起点城市:目前支持市内公交换乘/跨城公交的起点城市。 + *

+ * 可选值:城市名称/citycode + * @param cityd (选填)跨城公交规划时的终点城市:跨城公交规划必填参数。 + *

+ * 可选值:城市名称/citycode + * @param extensions (选填)返回结果详略:可选值:base(default)/all + *

+ * base:返回基本信息;all:返回全部信息 + * @param strategy (选填)公交换乘策略:可选值: + *

+ * 0:最快捷模式 + *

+ * 1:最经济模式 + *

+ * 2:最少换乘模式 + *

+ * 3:最少步行模式 + *

+ * 5:不乘地铁模式 + * @param nightflag (选填)是否计算夜班车:可选值:0:不计算夜班车 + *

+ * 1:计算夜班车 + * @param date (选填)出发日期:根据出发时间和日期,筛选可乘坐的公交路线,格式示例:date=2014-3-19。在无需设置预计出发时间时,请不要在请求之中携带此参数。 + * @param time (选填)出发时间:根据出发时间和日期,筛选可乘坐的公交路线,格式示例:time=22:34。在无需设置预计出发时间时,请不要在请求之中携带此参数 + * @return + */ + @Get(url = "/v3/direction/transit/integrated?output=json&origin=${origin.lng},${origin.lat}&destination=${destination.lng},${destination.lat}" + + "#{T(ForestUtils).parameter('cityd', #cityd)}" + + "#{T(ForestUtils).parameter('extensions', #extensions)}" + + "#{T(ForestUtils).parameter('strategy', #strategy)}" + + "#{T(ForestUtils).parameter('nightflag', #nightflag)}" + + "#{T(ForestUtils).parameter('date', #date)}" + + "#{T(ForestUtils).parameter('time', #time)}" + ) + IntegratedVo integratedV3(@Var("origin") CoordinateUtil.Coordinate origin, @Var("destination") CoordinateUtil.Coordinate destination, @Query("city") String city, String cityd, String extensions, String strategy, String nightflag, String date, String time); + + /** + * 驾车路径规划:驾车路径规划 API 可以规划以小客车、轿车通勤出行的方案,并且返回通勤方案的数据 + * + * @param origin (必填)出发点:经度在前,纬度在后,经度和纬度用","分割,经纬度小数点后不得超过6位。格式为x1,y1|x2,y2|x3,y3。 + *

+ * 由于在实际使用过程中,存在定位飘点的情况。为了解决此类问题,允许传入多个起点用于计算车头角度。 + *

+ * 最多允许传入3个坐标对,每对坐标之间距离必须超过2m。 虽然对每对坐标之间长度没有上限,但是如果超过4米会有概率性出现不准确的情况。使用三个点来判断距离和角度的有效性,如果两者都有效,使用第一个点和最后一个点计算的角度设置抓路的角度,规划路径时以最后一个坐标对进行规划。 + * @param destination (必填)目的地:经度在前,纬度在后,经度和纬度用","分割,经纬度小数点后不得超过6位。 + * @param originid (选填)出发点poiid:当起点为POI时,建议填充此值。 + * @param destinationid (选填)目的地poiid:当终点为POI时,建议填充此值。 + * @param origintype (选填)起点的poi类别:当用户知道起点POI的类别时候,建议填充此值 + * @param destinationtype (选填)终点的poi类别:当用户知道终点POI的类别时候,建议填充此值 + * @param strategy (选填)驾车选择策略:下方10~20的策略,会返回多条路径规划结果。(高德地图APP策略也包含在内,强烈建议从此策略之中选择) + *

+ * 下方策略 0~9的策略,仅会返回一条路径规划结果。 + *

+ *

+ *

+ *

+ *

+ * 下方策略返回多条路径规划结果 + *

+ * 10,返回结果会躲避拥堵,路程较短,尽量缩短时间,与高德地图的默认策略也就是不进行任何勾选一致 + *

+ * 11,返回三个结果包含:时间最短;距离最短;躲避拥堵 (由于有更优秀的算法,建议用10代替) + *

+ * 12,返回的结果考虑路况,尽量躲避拥堵而规划路径,与高德地图的“躲避拥堵”策略一致 + *

+ * 13,返回的结果不走高速,与高德地图“不走高速”策略一致 + *

+ * 14,返回的结果尽可能规划收费较低甚至免费的路径,与高德地图“避免收费”策略一致 + *

+ * 15,返回的结果考虑路况,尽量躲避拥堵而规划路径,并且不走高速,与高德地图的“躲避拥堵&不走高速”策略一致 + *

+ * 16,返回的结果尽量不走高速,并且尽量规划收费较低甚至免费的路径结果,与高德地图的“避免收费&不走高速”策略一致 + *

+ * 17,返回路径规划结果会尽量的躲避拥堵,并且规划收费较低甚至免费的路径结果,与高德地图的“躲避拥堵&避免收费”策略一致 + *

+ * 18,返回的结果尽量躲避拥堵,规划收费较低甚至免费的路径结果,并且尽量不走高速路,与高德地图的“避免拥堵&避免收费&不走高速”策略一致 + *

+ * 19,返回的结果会优先选择高速路,与高德地图的“高速优先”策略一致 + *

+ * 20,返回的结果会优先考虑高速路,并且会考虑路况躲避拥堵,与高德地图的“躲避拥堵&高速优先”策略一致 + *

+ *

+ *

+ *

+ *

+ * 下方策略仅返回一条路径规划结果 + *

+ * 0,速度优先,此路线不一定距离最短 + *

+ * 1,费用优先,不走收费路段,且耗时最少的路线 + *

+ * 2,距离优先,仅走距离最短的路线,但是可能存在穿越小路/小区的情况 + *

+ * 3,速度优先,不走快速路,例如京通快速路(因为策略迭代,建议使用13) + *

+ * 4,躲避拥堵,但是可能会存在绕路的情况,耗时可能较长 + *

+ * 5,多策略(同时使用速度优先、费用优先、距离优先三个策略计算路径)。 + *

+ * 其中必须说明,就算使用三个策略算路,会根据路况不固定的返回一~三条路径规划信息。 + *

+ * 6,速度优先,不走高速,但是不排除走其余收费路段 + *

+ * 7,费用优先,不走高速且避免所有收费路段 + *

+ * 8,躲避拥堵和收费,可能存在走高速的情况,并且考虑路况不走拥堵路线,但有可能存在绕路和时间较长 + *

+ * 9,躲避拥堵和收费,不走高速 + * @param waypoints (选填)途经点:经度和纬度用","分割,经度在前,纬度在后,小数点后不超过6位,坐标点之间用";"分隔 + *

+ * 最大数目:16个坐标点。如果输入多个途径点,则按照用户输入的顺序进行路径规划 + * @param avoidpolygons (选填)避让区域:区域避让,支持32个避让区域,每个区域最多可有16个顶点 + *

+ * 经度和纬度用","分割,经度在前,纬度在后,小数点后不超过6位,坐标点之间用";"分隔,区域之间用"|"分隔。如果是四边形则有四个坐标点,如果是五边形则有五个坐标点; + *

+ * 同时传入避让区域及避让道路,仅支持避让道路; + *

+ * 避让区域不能超过81平方公里,否则避让区域会失效 + * @param avoidroad (选填)避让道路名:只支持一条避让道路 + * @param province (选填)用汉字填入车牌省份缩写,用于判断是否限行:例如:京 + * @param number (选填)填入除省份及标点之外,车牌的字母和数字(需大写)。用于判断限行相关:例如:NH1N11 + *

+ * 支持6位传统车牌和7位新能源车牌 + * @param cartype (选填)车辆类型:0:普通汽车(默认值) + * 1:纯电动车 + * 2:插电混动车 + * @param ferry (选填)在路径规划中,是否使用轮渡:0:使用渡轮(默认) + * 1:不使用渡轮 + * @param roadaggregation (选填)是否返回路径聚合信息:false:不返回路径聚合信息 + *

+ * true:返回路径聚合信息,在steps上层增加roads做聚合 + * @param nosteps (选填)是否返回steps字段内容:当取值为0时,steps字段内容正常返回; + *

+ * 当取值为1时,steps字段内容为空; + * @param extensions (选填)返回结果控制:可选值:base/all + *

+ * base:返回基本信息;all:返回全部信息 + * @return 驾车路径规划 + */ + @Get(url = "/v3/direction/driving?output=json" + + "#{T(ForestUtils).parameter('originid', #originid)}" + + "#{T(ForestUtils).parameter('destinationid', #destinationid)}" + + "#{T(ForestUtils).parameter('origintype', #origintype)}" + + "#{T(ForestUtils).parameter('destinationtype', #destinationtype)}" + + "#{T(ForestUtils).parameter('strategy', #strategy)}" + + "#{T(ForestUtils).parameter('waypoints', #waypoints)}" + + "#{T(ForestUtils).parameter('avoidpolygons', #avoidpolygons)}" + + "#{T(ForestUtils).parameter('province', #province)}" + + "#{T(ForestUtils).parameter('number', #number)}" + + "#{T(ForestUtils).parameter('cartype', #cartype)}" + + "#{T(ForestUtils).parameter('ferry', #ferry)}" + + "#{T(ForestUtils).parameter('roadaggregation', #roadaggregation)}" + + "#{T(ForestUtils).parameter('nosteps', #nosteps)}" + + "#{T(ForestUtils).parameter('extensions', #extensions)}" + ) + DrivingV3Vo drivingV3(@Query("origin") String origin, @Query("destination") String destination + , String originid, String destinationid, String origintype, String destinationtype, String strategy, String waypoints, String avoidpolygons + , String avoidroad, String province, String number, String cartype, String ferry, String roadaggregation, String nosteps, String extensions); + + /** + * 骑行路径规划:骑行路径规划用于规划骑行通勤方案,规划时会考虑天桥、单行线、封路等情况。最大支持 500km 的骑行路线规划。 + * + * @param origin 出发点经纬度 + * @param destination 目的地经纬度 + * @return 骑行路径规划 + */ + @Get(url = "/v4/direction/bicycling?output=json&origin=${origin.lng},${origin.lat}&destination=${destination.lng},${destination.lat}") + BicyclingVo bicyclingV4(@Var("origin") CoordinateUtil.Coordinate origin, @Var("destination") CoordinateUtil.Coordinate destination); + + /** + * 公交站 ID 查询 + * + * @param id 公交站 id + * @return 公交站信息 + */ + @Get(url = "/v3/bus/stopid?output=json") + StopidVo stopidV3(@Query("id") String id); + + /** + * 公交路线 ID 查询 + * + * @param id (必填)公交线路 id:有效的高德公交线路 id + * @param extensions (可选)控制返回结果 可选:base,all + *

+ * base:返回公交路线基本信息 + *

+ * all:返回基本+详细信息(详细信息包含途径站点,首末班车时间等) + * @return 公交路线信息 + */ + @Get(url = "/v3/bus/lineid?output=json" + "#{T(ForestUtils).parameter('extensions', #extensions)}") + LineidVo lineidV3(@Query("id") String id, String extensions); + + /** + * 公交站关键字查询 + * + * @param keywords (必填)查询关键字:只支持一个关键字 + * @param city (可选)城市:支持adcode、citycode + *

+ * adcode 信息可参考城市编码表获取 + * @param offset (可选)每页记录数据:最大 100 + * @param page (可选)当前页面:最大 100 + * @return 公交站信息 + */ + @Get(url = "/v3/bus/stopname?output=json" + + "#{T(ForestUtils).parameter('city', #city)}" + + "#{T(ForestUtils).parameter('offset', #offset)}" + + "#{T(ForestUtils).parameter('page', #page)}") + StopidVo stopnameV3(@Query("keywords") String keywords, String city, String offset, String page); + + /** + * 公交站关键字查询 + * + * @param keywords (必填)查询关键字:只支持一个关键字 + * @param city (必选)城市:支持adcode、citycode + *

+ * adcode 信息可参考城市编码表获取 + * @param offset (可选)每页记录数据:规则:大于 100 按默认值 默认值:20 + * @param page (可选)当前页面:最大翻页数 10 默认值:1 + * @param extensions (可选)控制返回结果 可选:base,all + *

+ * base:返回公交路线基本信息 + *

+ * all:返回基本+详细信息(详细信息包含途径站点,首末班车时间等) + * @return 公交站信息 + */ + @Get(url = "/v3/bus/linename?output=json" + + "#{T(ForestUtils).parameter('offset', #offset)}" + + "#{T(ForestUtils).parameter('page', #page)}" + + "#{T(ForestUtils).parameter('extensions', #extensions)}" + ) + LinenameVo linenameV3(@Query("keywords") String keywords, @Query("city") String city, String offset, String page, String extensions); + + /** + * 行政区域查询 + * + * @param keywords (可选)查询关键字,规则:只支持单个关键词语搜索关键词支持:行政区名称、citycode、adcode + *

+ * 例如,在subdistrict=2,搜索省份(例如山东),能够显示市(例如济南),区(例如历下区) + * @param subdistrict (可选)子级行政区:规则:设置显示下级行政区级数(行政区级别包括:国家、省/直辖市、市、区/县、乡镇/街道多级数据) + *

+ * 可选值:0、1、2、3等数字,并以此类推 + *

+ * 0:不返回下级行政区; + *

+ * 1:返回下一级行政区; + *

+ * 2:返回下两级行政区; + *

+ * 3:返回下三级行政区; + *

+ *

+ *

+ * 需要在此特殊说明,目前部分城市和省直辖县因为没有区县的概念,故在市级下方直接显示街道。 + *

+ * 例如:广东-东莞、海南-文昌市 + * @param page (可选)需要第几页数据:最外层的districts最多会返回20个数据,若超过限制,请用page请求下一页数据。 + *

+ * 例如page=2;page=3。默认page=1 + * @param offset (可选)最外层返回数据个数,默认为20 + * @param extensions (可选)返回结果控制:此项控制行政区信息中返回行政区边界坐标点; 可选值:base、all; + *

+ * base:不返回行政区边界坐标点; + *

+ * all:只返回当前查询district的边界值,不返回子节点的边界值; + *

+ * 目前不能返回乡镇/街道级别的边界值 + * @param filter (可选)根据区划过滤:按照指定行政区划进行过滤,填入后则只返回该省/直辖市信息 + *

+ * 需填入adcode,为了保证数据的正确,强烈建议填入此参数 + * @return 行政区信息 + */ + @Get(url = "/v3/config/district?output=json" + + "#{T(ForestUtils).parameter('keywords', #keywords)}" + + "#{T(ForestUtils).parameter('subdistrict', #subdistrict)}" + + "#{T(ForestUtils).parameter('page', #page)}" + + "#{T(ForestUtils).parameter('offset', #offset)}" + + "#{T(ForestUtils).parameter('extensions', #extensions)}" + + "#{T(ForestUtils).parameter('filter', #filter)}" + ) + DistrictVo districtV3(String keywords, String subdistrict, String page, String offset, String extensions, String filter); + + /** + * 静态地图 + * + * @param location (必填)地图中心点:中心点坐标 + *

+ * 规则:经度和纬度用","分隔 经纬度小数点后不得超过6位。 + * @param zoom (必填)地图级别:地图缩放级别:[1,17] + * @param size (可选)地图大小:图片宽度*图片高度。最大值为1024*1024 + * @param scale (可选)普通/高清: + * 1:返回普通图; + *

+ * 2:调用高清图,图片高度和宽度都增加一倍,zoom也增加一倍(当zoom为最大值时,zoom不再改变) + * @param markers (可选)标注:使用规则见markers详细说明,标注最大数10个 + * @param labels (可选)标签:使用规则见labels详细说明,标签最大数10个 + * @param paths (可选)折线:使用规则见paths详细说明,折线和多边形最大数4个 + * @param traffic (可选)交通路况标识:底图是否展现实时路况。 可选值: 0,不展现;1,展现。 + * @return 静态地图 + */ + @Get(url = "/v3/staticmap?output=json&location=${location.lng},${location.lat}" + + "#{T(ForestUtils).parameter('size', #size)}" + + "#{T(ForestUtils).parameter('scale', #scale)}" + + "#{T(ForestUtils).parameter('markers', #markers)}" + + "#{T(ForestUtils).parameter('labels', #labels)}" + + "#{T(ForestUtils).parameter('paths', #paths)}" + + "#{T(ForestUtils).parameter('traffic', #traffic)}" + ) + String staticmapV3(@Var("location") CoordinateUtil.Coordinate location, @Query("zoom") String zoom, String size, String scale, String markers, String labels, String paths, String traffic); + + /** + * 发起驾驶路线纠偏请求 + * + * @param drivingBo 驾驶路线数据列表 + * @return 驾驶路线纠偏结果 + */ + + @Post(url = "/v4/grasproad/driving") + DrivingVo drivingV4(@Body List drivingBo); + + /** + * 关键字搜索 + * + * @param keywords (必填(keywords和types两者至少必选其一))查询关键字:规则: 只支持一个关键字 + *

+ * 若不指定city,并且搜索的为泛词(例如“美食”)的情况下,返回的内容为城市列表以及此城市内有多少结果符合要求 + * @param types (必填(keywords和types两者至少必选其一))查询POI类型:可选值:分类代码 或 汉字(若用汉字,请严格按照附件之中的汉字填写) + *

+ * 规则: 多个关键字用“|”分割 + *

+ * 分类代码由六位数字组成,一共分为三个部分,前两个数字代表大类;中间两个数字代表中类;最后两个数字代表小类。 + *

+ * 若指定了某个大类,则所属的中类、小类都会被显示。 + *

+ * 例如:010000为汽车服务(大类) + *

+ * 010100为加油站(中类) + *

+ * 010101为中国石化(小类) + *

+ * 010900为汽车租赁(中类) + *

+ * 010901为汽车租赁还车(小类) + *

+ * 当指定010000,则010100等中类、010101等小类都会被包含,当指定010900,则010901等小类都会被包含。 + *

+ * 下载POI分类编码和城市编码表 + *

+ * 若不指定city,返回的内容为城市列表以及此城市内有多少结果符合要求。 + *

+ * 当您的keywords和types都是空时,默认指定types为120000(商务住宅)&150000(交通设施服务) + * @param city (可选)查询城市:可选值:城市中文、citycode、adcode + *

+ * 如:北京/010/110000 + *

+ * 填入此参数后,会尽量优先返回此城市数据,但是不一定仅局限此城市结果,若仅需要某个城市数据请调用citylimit参数。 + *

+ * 如:在深圳市搜天安门,返回北京天安门结果。 + * @param citylimit (可选)仅返回指定城市数据:可选值:true/false + * @param children (可选)是否按照层级展示子POI数据:可选值:children=1 + *

+ * 当为0的时候,子POI都会显示。 + *

+ * 当为1的时候,子POI会归类到父POI之中。 + *

+ * 在extensions=all 或者为空时生效 + * @param offset (可选)每页记录数据:强烈建议不超过25,若超过25可能造成访问报错 + * @param page (可选)当前页数 + * @param extensions (可选)返回结果控制:此项默认返回基本地址信息;取值为all返回地址信息、附近POI、道路以及道路交叉口信息 + * @return 关键字搜索结果 + */ + @Get(url = "/v3/place/text?output=json" + + "#{T(ForestUtils).parameter('keywords', #keywords)}" + + "#{T(ForestUtils).parameter('types', #types)}" + + "#{T(ForestUtils).parameter('city', #city)}" + + "#{T(ForestUtils).parameter('citylimit', #citylimit)}" + + "#{T(ForestUtils).parameter('children', #children)}" + + "#{T(ForestUtils).parameter('offset', #offset)}" + + "#{T(ForestUtils).parameter('page', #page)}" + + "#{T(ForestUtils).parameter('extensions', #extensions)}" + ) + TextVo textV3(String keywords, String types, String city, String citylimit, String children, String offset, String page, String extensions); + + /** + * 周边搜索 + * + * @param location (必填)中心点坐标 + * @param keywords (可选)查询关键字:规则: 只支持一个关键字 + * @param types (可选)查询POI类型:多个类型用“|”分割; + *

+ * 可选值:分类代码 或 汉字 (若用汉字,请严格按照附件之中的汉字填写) + *

+ * 分类代码由六位数字组成,一共分为三个部分,前两个数字代表大类;中间两个数字代表中类;最后两个数字代表小类。 + *

+ * 若指定了某个大类,则所属的中类、小类都会被显示。 + *

+ * 例如:010000为汽车服务(大类) + *

+ * 010100为加油站(中类) + *

+ * 010101为中国石化(小类) + *

+ * 010900为汽车租赁(中类) + *

+ * 010901为汽车租赁还车(小类) + *

+ * 当指定010000,则010100等中类、010101等小类都会被包含。 + *

+ * 当指定010900,则010901等小类都会被包含 + *

+ * 下载POI分类编码和城市编码表 + *

+ * 当keywords和types均为空的时候,默认指定types为050000(餐饮服务)、070000(生活服务)、120000(商务住宅) + * @param city (可选)查询城市:可选值:城市中文、中文全拼、citycode、adcode + *

+ * 如:北京/beijing/010/110000 + *

+ * 当用户指定的经纬度和city出现冲突,若范围内有用户指定city的数据,则返回相关数据,否则返回为空。 + *

+ * 如:经纬度指定石家庄,而city却指定天津,若搜索范围内有天津的数据则返回相关数据,否则返回为空。 + * @param radius (可选)查询半径:取值范围:0-50000。规则:大于50000按默认值,单位:米 + * @param sortrule (可选)排序规则:规定返回结果的排序规则。按距离排序:distance;综合排序:weight + * @param offset (可选)每页记录数据:强烈建议不超过25,若超过25可能造成访问报错 + * @param page (可选)当前页数 + * @param extensions (可选)返回结果控制:此项默认返回基本地址信息;取值为all返回地址信息、附近POI、道路以及道路交叉口信息 + * @return 周边搜索结果 + */ + @Get(url = "/v3/place/around?output=json&location=${location.lng},${location.lat}" + + "#{T(ForestUtils).parameter('keywords', #keywords)}" + + "#{T(ForestUtils).parameter('types', #types)}" + + "#{T(ForestUtils).parameter('city', #city)}" + + "#{T(ForestUtils).parameter('radius', #radius)}" + + "#{T(ForestUtils).parameter('sortrule', #sortrule)}" + + "#{T(ForestUtils).parameter('offset', #offset)}" + + "#{T(ForestUtils).parameter('page', #page)}" + + "#{T(ForestUtils).parameter('extensions', #extensions)}" + ) + TextVo aroundV3(@Var("location") CoordinateUtil.Coordinate location, String keywords, String types, String city, String radius, String sortrule, String offset, String page, String extensions); + + /** + * 多边形搜索 + * + * @param polygon (必填)经纬度坐标对:规则:经度和纬度用","分割,经度在前,纬度在后,坐标对用"|"分割。经纬度小数点后不得超过6位。多边形为矩形时,可传入左上右下两顶点坐标对;其他情况下首尾坐标对需相同 + * @param keywords (可选)查询关键字:规则: 只支持一个关键字 + * @param types (可选)查询POI类型:多个类型用“|”分割; + *

+ * 可选值:分类代码 或 汉字 (若用汉字,请严格按照附件之中的汉字填写) + *

+ * 分类代码由六位数字组成,一共分为三个部分,前两个数字代表大类;中间两个数字代表中类;最后两个数字代表小类。 + *

+ * 若指定了某个大类,则所属的中类、小类都会被显示。 + *

+ * 例如:010000为汽车服务(大类) + *

+ * 010100为加油站(中类) + *

+ * 010101为中国石化(小类) + *

+ * 010900为汽车租赁(中类) + *

+ * 010901为汽车租赁还车(小类) + *

+ * 当指定010000,则010100等中类、010101等小类都会被包含。 + *

+ * 当指定010900,则010901等小类都会被包含 + *

+ * 下载POI分类编码和城市编码表 + *

+ * 当keywords和types为空的时候, 我们会默认指定types为120000(商务住宅)&150000(交通设施服务) + * @param offset (可选)每页记录数据:强烈建议不超过25,若超过25可能造成访问报错 + * @param page (可选)当前页数 + * @param extensions (可选)返回结果控制:此项默认返回基本地址信息;取值为all返回地址信息、附近POI、道路以及道路交叉口信息 + * @return 多边形搜索结果 + */ + @Get(url = "/v3/place/polygon?output=json&polygon=${polygon.lng},${polygon.lat}" + + "#{T(ForestUtils).parameter('keywords', #keywords)}" + + "#{T(ForestUtils).parameter('types', #types)}" + + "#{T(ForestUtils).parameter('offset', #offset)}" + + "#{T(ForestUtils).parameter('page', #page)}" + + "#{T(ForestUtils).parameter('extensions', #extensions)}" + ) + TextVo polygonV3(@Var("polygon") CoordinateUtil.Coordinate polygon, String keywords, String types, String offset, String page, String extensions); + + /** + * ID查询 + * + * @param id AOI唯一标识:最多可以传入1个id,传入目标区域的poiid即可 + * @return ID查询结果 + */ + @Get(url = "/v3/place/detail?output=json") + TextVo detailV3(@Query("id") String id); + + /** + * AOI边界查询 + * + * @param id AOI唯一标识:最多可以传入1个id,传入目标区域的poiid即可 + * @return ID查询结果 + */ + @Get(url = "/v5/aoi/polyline?output=json") + PolylineVo polylineV5(@Query("id") String id); + + /** + * 输入提示 + * + * @param keywords (必填)查询关键词 + * @param type (可选)POI分类:服务可支持传入多个分类,多个类型剑用“|”分隔 + *

+ * 可选值:POI分类名称、分类代码 + *

+ * 此处强烈建议使用分类代码,否则可能会得到不符合预期的结果 + * @param location (可选)坐标:格式:“X,Y”(经度,纬度),不可以包含空格 + *

+ * 建议使用location参数,可在此location附近优先返回搜索关键词信息 + *

+ * 在请求参数city不为空时生效 + * @param city (可选)搜索城市:可选值:citycode、adcode,不支持县级市。 + *

+ * 如:010/110000 + *

+ * adcode信息可参考城市编码表获取。 + *

+ * 填入此参数后,会尽量优先返回此城市数据,但是不一定仅局限此城市结果,若仅需要某个城市数据请调用citylimit参数。 + *

+ * 如:在深圳市搜天安门,返回北京天安门结果。 + * @param citylimit (可选)仅返回指定城市数据:可选值:true/false + * @param datatype (可选)返回的数据类型:多种数据类型用“|”分隔,可选值:all-返回所有数据类型、poi-返回POI数据类型、bus-返回公交站点数据类型、busline-返回公交线路数据类型 + * @return 提示信息 + */ + @Get(url = "/v3/assistant/inputtips?output=json" + + "#{T(ForestUtils).parameter('type', #type)}" + + "#{T(ForestUtils).parameter('location', #location)}" + + "#{T(ForestUtils).parameter('city', #city)}" + + "#{T(ForestUtils).parameter('citylimit', #citylimit)}" + + "#{T(ForestUtils).parameter('datatype', #datatype)}" + ) + InputtipsVo inputtipsV3(@Query("keywords") String keywords, String type, String location, String city, String citylimit, String datatype); + + /** + * 智能硬件定位 + * 为了尽可能地保证您定位结果的精确性,在以上所有场景中,除了必须填写的参数外,其他可以获得的参数也请一并传入 + * + * @param accesstype (必填)移动端接入网络方式 :可选值: + *

+ * 移动接入网络:0 + *

+ * wifi 接入网络:1 + * @param imei (必填)手机 imei 号 + * @param idfa (可选)ios 手机的 idfa + * @param smac (可选)手机 mac 码 + * @param serverip (可选)设备接入基站时对应的网关 IP + * @param cdma (可选)是否为 cdma :是否为 cdma: + *

+ * 非 cdma:0 + *

+ * 是 cdma:1 + * @param imsi (可选)移动用户识别码 : + * @param network (可选)无线网络类型 :GSM/GPRS/EDGE/HSUPA/HSDPA/WCDMA + * @param tel (可选)手机号码 : + * @param bts (可选)接入基站信息 :接入基站信息,详见:表 1-2 内部参数说明 + *

+ * 非 CDMA 格式为:mcc,mnc,lac,cellid,signal + *

+ * CDMA 格式为:sid,nid,bid,lon,lat,signal + *

+ * 其中 lon,lat 可为空,格式为:sid,nid,bid,,,signa + * @param nearbts (可选)周边基站信息(不含接入基站信息) :基站信息 1|基站信息 2|基站信息 3….. + * @param mmac (可选)已连热点 mac 信息 :mac,signal,ssid + *

+ * 如: + *

+ * mac:f0:7d:68:9e:7d:18 + *

+ * signal:-41 + *

+ * ssid:TPLink + * @param macs (可选)wifi 列表中 mac 信息 :单 mac 信息同 mmac,mac 之间使用“|” 分隔。必须填写 2 个及 2 个以上,30 个以内的方可正常定位。请不要包含移动 wifi 信息 + * @return 智能硬件定位Vo + */ + @Get(url = "https://apilocate.amap.com/position?output=json" + + "#{T(ForestUtils).parameter('idfa', #idfa)}" + + "#{T(ForestUtils).parameter('smac', #smac)}" + + "#{T(ForestUtils).parameter('serverip', #serverip)}" + + "#{T(ForestUtils).parameter('cdma', #cdma)}" + + "#{T(ForestUtils).parameter('imsi', #imsi)}" + + "#{T(ForestUtils).parameter('network', #network)}" + + "#{T(ForestUtils).parameter('tel', #tel)}" + + "#{T(ForestUtils).parameter('bts', #bts)}" + + "#{T(ForestUtils).parameter('nearbts', #nearbts)}" + + "#{T(ForestUtils).parameter('mmac', #mmac)}" + + "#{T(ForestUtils).parameter('macs', #macs)}" + ) + PositionVo position(@Query("accesstype") String accesstype, @Query("imei") String imei, String idfa, String smac, String serverip, String cdma, String imsi, String network, String tel, String bts, String nearbts, String mmac, String macs); + + /** + * 智能硬件定位 2.0 + * 为了尽可能地保证您定位结果的精确性,在以上所有场景中,除了必须填写的参数外,其他可以获得的参数也请一并传入 + * + * @param accesstype (必填)移动端接入网络方式 :可选值: + *

+ * 移动接入网络:0 + *

+ * wifi 接入网络:1 + * @param diu (可选)设备唯一编号 + * @param cdma (可选)是否为 cdma :是否为 cdma: + *

+ * 非 cdma:0 + *

+ * 是 cdma:1 + * @param network (可选)无线网络类型 :GSM/GPRS/EDGE/HSUPA/HSDPA/WCDMA + * @param bts (可选)接入基站信息 :接入基站信息,详见:表 1-2 内部参数说明 + *

+ * 非 CDMA 格式为:mcc,mnc,lac,cellid,signal + *

+ * CDMA 格式为:sid,nid,bid,lon,lat,signal + *

+ * 其中 lon,lat 可为空,格式为:sid,nid,bid,,,signa + * @param nearbts (可选)周边基站信息(不含接入基站信息) :基站信息 1|基站信息 2|基站信息 3….. + * @param historybts (可选)历史基站信息 :历史定位基站信息,用于辅助定位。格式与周边基站信息相同 + * @param mmac (可选)已连热点 mac 信息 :mac,signal,ssid + *

+ * 如: + *

+ * mac:f0:7d:68:9e:7d:18 + *

+ * signal:-41 + *

+ * ssid:TPLink + * @param macs (可选)wifi 列表中 mac 信息 :单 mac 信息同 mmac,mac 之间使用“|” 分隔。必须填写 2 个及 2 个以上,30 个以内的方可正常定位。请不要包含移动 wifi 信息 + * @return 智能硬件定位Vo + */ + @Post(url = "/v5/position/IoT?output=json" + + "#{T(ForestUtils).parameter('diu', #diu)}" + + "#{T(ForestUtils).parameter('cdma', #cdma)}" + + "#{T(ForestUtils).parameter('network', #network)}" + + "#{T(ForestUtils).parameter('bts', #bts)}" + + "#{T(ForestUtils).parameter('nearbts', #nearbts)}" + + "#{T(ForestUtils).parameter('historybts', #historybts)}" + + "#{T(ForestUtils).parameter('mmac', #mmac)}" + + "#{T(ForestUtils).parameter('macs', #macs)}" + ) + Position2Vo positionV5(@Query("accesstype") String accesstype, String diu, String cdma, String network, String bts, String nearbts, String historybts, String mmac, String macs); + + /** + * 指定线路交通态势查询 + * + * @param level (必填)道路等级:指定道路等级,下面各值代表的含义: 1:高速(京藏高速) 2:城市快速路、国道(西三环、103 国道) 3:高速辅路(G6 辅路) 4:主要道路(长安街、三环辅路) 5:一般道路(彩和坊路) 6:无名道路 注:以上值是包含关系,如 5 除自身道路以外还包含 1,2,3,4 的道路 + * @param name (必填)街道名:道路名称 + * @param city (可选)城市名:由于开发者可能对城市称呼和高德的称呼存在差异(例如开发者称呼为深圳,但高德仅识别深圳市)。 故强烈建议使用 adcode,不使用 city字段 + * @param adcode (可选)城市编码:由于开发者可能对城市称呼和高德的称呼存在差异(例如开发者称呼为深圳,但高德仅识别深圳市)。 故强烈建议使用 adcode,不使用 city字段 + *

+ * adcode信息可参考城市编码表获取 + * @return 交通态势信息 + */ + @Get(url = "/v3/traffic/status/road?output=json" + + "#{T(ForestUtils).parameter('city', #city)}" + + "#{T(ForestUtils).parameter('adcode', #adcode)}" + ) + RoadVo roadV3(@Query("level") String level, @Query("name") String name, String city, String adcode); + + /** + * 圆形区域内交通态势查询 + * + * @param level (必填)道路等级:指定道路等级,下面各值代表的含义: 1:高速(京藏高速) 2:城市快速路、国道(西三环、103 国道) 3:高速辅路(G6 辅路) 4:主要道路(长安街、三环辅路) 5:一般道路(彩和坊路) 6:无名道路 注:以上值是包含关系,如 5 除自身道路以外还包含 1,2,3,4 的道路 + * @param location (必填)中心点坐标 :经度在前,纬度在后。经度和纬度用","分割。经纬度小数点后不得超过6位 + * @param radius (可选)半径 :单位:米,最大取值 5000 米 + * @param extensions (可选)控制返回内容:可选:base,all + *

+ * base:返回基本信息 + *

+ * all:返回基本+详细信息 + * @return 交通态势信息 + */ + @Get(url = "/v3/traffic/status/circle?output=json&location=${location.lng},${location.lat}" + + "#{T(ForestUtils).parameter('radius', #radius)}" + + "#{T(ForestUtils).parameter('extensions', #extensions)}" + ) + CircleVo circleV3(@Query("level") String level, @Var("location") CoordinateUtil.Coordinate location, String radius, String extensions); + + /** + * 矩形区域内交通态势查询 + * + * @param level (必填)道路等级:指定道路等级,下面各值代表的含义: 1:高速(京藏高速) 2:城市快速路、国道(西三环、103 国道) 3:高速辅路(G6 辅路) 4:主要道路(长安街、三环辅路) 5:一般道路(彩和坊路) 6:无名道路 注:以上值是包含关系,如 5 除自身道路以外还包含 1,2,3,4 的道路 + * @param rectangle (必填)希望查询矩形坐标 :左下右上顶点坐标对。矩形对角线不能超过 10 公里两个坐标对之间用”;”间隔。 xy 之间用”,”间隔最后格式为 x1,y1;x2,y2 + * @param extensions (可选)控制返回内容:可选:base,all + *

+ * base:返回基本信息 + *

+ * all:返回基本+详细信息 + * @return 交通态势信息 + */ + @Get(url = "/v3/traffic/status/rectangle?output=json" + + "#{T(ForestUtils).parameter('extensions', #extensions)}" + ) + RectangleVo rectangleV3(@Query("level") String level, @Query("rectangle") String rectangle, String extensions); + + /** + * 未来路径规划 + * + * @param origin (必填)出发点: + * @param destination (必填)目的地: + * @param firsttime (必填)出发时间,第一个时间戳:unix时间戳,精确到秒,必须是未来时间,如果小于当前时间会报错。 + * @param interval (必填)时间间隔:单位:秒 + * @param count (必填)时间点个数:最多支持48个 + * @param strategy (可选)规划策略:1.返回的结果考虑路况,尽量躲避拥堵而规划路径,与高德地图的“躲避拥堵”策略一致 + *

+ * 2.返回的结果不走高速,与高德地图“不走高速”策略一致 + *

+ * 3.返回的结果尽可能规划收费较低甚至免费的路径,与高德地图“避免收费”策略一致 + *

+ * 4.返回的结果考虑路况,尽量躲避拥堵而规划路径,并且不走高速,与高德地图的“躲避拥堵&不走高速”策略一致 + *

+ * 5.返回的结果尽量不走高速,并且尽量规划收费较低甚至免费的路径结果,与高德地图的“避免收费&不走高速”策略一致 + *

+ * 6.返回路径规划结果会尽量的躲避拥堵,并且规划收费较低甚至免费的路径结果,与高德地图的“躲避拥堵&避免收费”策略一致 + *

+ * 7.返回的结果尽量躲避拥堵,规划收费较低甚至免费的路径结果,并且尽量不走高速路,与高德地图的“避免拥堵&避免收费&不走高速”策略一致 + *

+ * 8.返回的结果会优先选择高速路,与高德地图的“高速优先”策略一致 + *

+ * 9.返回的结果会优先考虑高速路,并且会考虑路况躲避拥堵,与高德地图的“躲避拥堵&高速优先”策略一致 + *

+ * 10.不考虑路况,返回速度最优、耗时最短的路线,但是此路线不一定距离最短 + *

+ * 11.避让拥堵&速度优先&避免收费 + * @param province (可选)用汉字填入车牌省份缩写,用于判断是否限行:例如:京 + * @param number (可选)填入除省份及标点之外,车牌的字母和数字(需大写)。用于判断限行相关:例如:NH1N11 + *

+ * 支持 6 位传统车牌和7位新能源车牌 + * @param cartype (可选)车辆类型:0:普通汽车(默认值) 1:纯电动车 2:插电混动车 + * @return 未来路径规划结果 + */ + @Get(url = "/v4/etd/driving?output=json&origin=${origin.lng},${origin.lat}&destination=${destination.lng},${destination.lat}" + + "#{T(ForestUtils).parameter('strategy', #strategy)}" + + "#{T(ForestUtils).parameter('province', #province)}" + + "#{T(ForestUtils).parameter('number', #number)}" + + "#{T(ForestUtils).parameter('cartype', #cartype)}" + ) + DrivingV4Vo drivingV4(@Var("origin") CoordinateUtil.Coordinate origin, @Var("destination") CoordinateUtil.Coordinate destination, @Query("firsttime") String firsttime, @Query("interval") String interval, @Query("count") String count, String strategy, String province, String number, String cartype); + + /** + * 三方数据空间检索:关键字搜索 + * + * @param datasetId (必填)数据集ID:暂时仅支持单个数据集 + * @param keywords (必填)关键字:[string1]|[string2]|[string3] + *

+ * 所有字段类型均parse成string + * @param field (可选)属性字段:选择关键字所在的属性字段 + *

+ * 例如:[属性1]|[属性2]|[属性3] + * @param type (可选)条件类型:0: 包含 + *

+ * 1:等于 + * @param offset (可选)每页记录数据:整型, 强烈建议不超过25,若超过25可能造成访问报错 + * @param page (可选)当前页数:整型 + * @return 三方数据空间检索结果 + */ + @Get(url = "/rest/lbs/geohub/place/text?output=json" + + "#{T(ForestUtils).parameter('properties_field', #field)}" + + "#{T(ForestUtils).parameter('condition_type', #type)}" + + "#{T(ForestUtils).parameter('offset', #offset)}" + + "#{T(ForestUtils).parameter('page', #page)}" + ) + GeohubVo text(@Query("dataset_id") String datasetId, @Query("keywords") String keywords, String field, String type, Integer offset, Integer page); + + /** + * 三方数据空间检索:多边形搜索 + * + * @param datasetId (必填)数据集ID:暂时仅支持单个数据集 + * @param polygon (必填)多边形区域:多个坐标对集合,坐标对用"|"分割。多边形为矩形时,可传入左上右下两顶点坐标对;其他情况下首尾坐标对需相同。 + * @param properties (可选)筛选条件:各属性类型支持的操作, JSON数据, 示例: + *

+ * { + *

+ * "relation": "and", // 各个属性间的或与操作, 可选and,&&,or,|| + *

+ * "conditions": [{ + *

+ * "field": "alias", // 属性名 + *

+ * "operation": "like", // 逻辑操作, 可选equal,=,not_equal,<>,greater,>,greater_equal,>=,less,<,less_equal,<=,in,like_any,like,not_like + *

+ * "value": "别名" // 属性值 + *

+ * }] + *

+ * } + *

+ * 两层逻辑(age字段>1且<10)示例: + *

+ * { + *

+ * "relation": "and", + *

+ * "conditions": [{ + *

+ * "field": "age", + *

+ * "relation": "and", + *

+ * "conditions":[{ + *

+ * "operation": ">", + *

+ * "value": 1 + *

+ * },{ + *

+ * "operation": "<", + *

+ * "value": 10 + *

+ * }] + *

+ * }] + *

+ * } + * @param offset (可选)每页记录数据:整型, 强烈建议不超过25,若超过25可能造成访问报错 + * @param page (可选)当前页数:整型 + * @return 三方数据空间检索结果 + */ + @Get(url = "/rest/lbs/geohub/place/polygon?output=json" + + "#{T(ForestUtils).parameter('properties', #properties)}" + + "#{T(ForestUtils).parameter('offset', #offset)}" + + "#{T(ForestUtils).parameter('page', #page)}" + ) + GeohubVo polygon(@Query("dataset_id") String datasetId, @Query("polygon") String polygon, String properties, Integer offset, Integer page); + + /** + * 三方数据空间检索: 周边搜索 + * + * @param datasetId (必填)数据集ID:暂时仅支持单个数据集 + * @param location (必填)中心点位置:多中心点经纬度坐标, 如: 120.165904,35.982862 + * @param radius (必填)半径:以中心点为圆心的距离半径(单位:m)取值范围:(0,50000] + * @param properties (可选)筛选条件:各属性类型支持的操作, JSON数据, 示例: + *

+ * { + *

+ * "relation": "and", // 各个属性间的或与操作, 可选and,&&,or,|| + *

+ * "conditions": [{ + *

+ * "field": "alias", // 属性名 + *

+ * "operation": "like", // 逻辑操作, 可选equal,=,not_equal,<>,greater,>,greater_equal,>=,less,<,less_equal,<=,in,like_any,like,not_like + *

+ * "value": "别名" // 属性值 + *

+ * }] + *

+ * } + *

+ * 两层逻辑(age字段>1且<10)示例: + *

+ * { + *

+ * "relation": "and", + *

+ * "conditions": [{ + *

+ * "field": "age", + *

+ * "relation": "and", + *

+ * "conditions":[{ + *

+ * "operation": ">", + *

+ * "value": 1 + *

+ * },{ + *

+ * "operation": "<", + *

+ * "value": 10 + *

+ * }] + *

+ * }] + *

+ * } + * @param offset (可选)每页记录数据:整型, 强烈建议不超过25,若超过25可能造成访问报错 + * @param page (可选)当前页数:整型 + * @return 三方数据空间检索结果 + */ + @Get(url = "/rest/lbs/geohub/place/around?output=json" + + "#{T(ForestUtils).parameter('properties', #properties)}" + + "#{T(ForestUtils).parameter('offset', #offset)}" + + "#{T(ForestUtils).parameter('page', #page)}" + ) + GeohubVo around(@Query("dataset_id") String datasetId, @Query("location") String location, @Query("radius") String radius, String properties, Integer offset, Integer page); + + /** + * 三方数据空间检索: 属性筛选 + * + * @param datasetId (必填)数据集ID:暂时仅支持单个数据集 + * @param properties (必填)筛选条件:各属性类型支持的操作, JSON数据, 示例: + *

+ * { + *

+ * "relation": "and", // 各个属性间的或与操作, 可选and,&&,or,|| + *

+ * "conditions": [{ + *

+ * "field": "alias", // 属性名 + *

+ * "operation": "like", // 逻辑操作, 可选equal,=,not_equal,<>,greater,>,greater_equal,>=,less,<,less_equal,<=,in,like_any,like,not_like + *

+ * "value": "别名" // 属性值 + *

+ * }] + *

+ * } + *

+ * 两层逻辑(age字段>1且<10)示例: + *

+ * { + *

+ * "relation": "and", + *

+ * "conditions": [{ + *

+ * "field": "age", + *

+ * "relation": "and", + *

+ * "conditions":[{ + *

+ * "operation": ">", + *

+ * "value": 1 + *

+ * },{ + *

+ * "operation": "<", + *

+ * "value": 10 + *

+ * }] + *

+ * }] + *

+ * } + * @param offset (可选)每页记录数据:整型, 强烈建议不超过25,若超过25可能造成访问报错 + * @param page (可选)当前页数:整型 + * @return 三方数据空间检索结果 + */ + @Get(url = "/rest/lbs/geohub/place/properties?output=json" + + "#{T(ForestUtils).parameter('offset', #offset)}" + + "#{T(ForestUtils).parameter('page', #page)}" + ) + GeohubVo properties(@Query("dataset_id") String datasetId, @Query("properties") String properties, Integer offset, Integer page); + +} diff --git a/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/client/GuideIntercepto.java b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/client/GuideIntercepto.java new file mode 100644 index 000000000..37fd2331f --- /dev/null +++ b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/client/GuideIntercepto.java @@ -0,0 +1,28 @@ +package org.dromara.guide.client; + +import com.dtflys.forest.http.ForestRequest; +import com.dtflys.forest.interceptor.Interceptor; +import lombok.extern.slf4j.Slf4j; +import org.dromara.common.core.utils.SpringUtils; + +/** + * 请求拦截 请求前添加key + * + * @author AprilWind + */ +@Slf4j +public class GuideIntercepto implements Interceptor { + + private static final String KEY = SpringUtils.getProperty("client.guide.key"); + + /** + * 该方法在请求发送之前被调用, 若返回false则不会继续发送请求 + * + * @param request Forest请求对象 + */ + @Override + public boolean beforeExecute(ForestRequest request) { + request.addQuery("key", KEY); + return true; + } +} diff --git a/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/client/GuideTrafficClient.java b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/client/GuideTrafficClient.java new file mode 100644 index 000000000..ec1159f82 --- /dev/null +++ b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/client/GuideTrafficClient.java @@ -0,0 +1,28 @@ +package org.dromara.guide.client; + +import com.dtflys.forest.annotation.BaseRequest; +import com.dtflys.forest.annotation.Get; +import com.dtflys.forest.annotation.Query; +import org.dromara.guide.domain.vo.TrafficVo; + +/** + * 高德地图API请求服务 + *

参考文档:GuideTrafficClient

+ * + * @author AprilWind + */ +@BaseRequest(baseURL = "https://et-api.amap.com", charset = "UTF-8") +public interface GuideTrafficClient { + + /** + * 交通事件查询 + * + * @param adcode 城市代码:授权城市ADCODE(城市级) + * @param eventType 事件类型:仅获取对应类型事件,多个;分割 + * @param isExpressway 只获取高速:仅获取高速类事件。1-是 0-否 + * @return TrafficVo 事件信息 + */ + @Get(url = "/event/queryByAdcode", interceptor = GuideTrafficIntercepto.class) + TrafficVo queryByAdcode(@Query("adcode") String adcode, @Query("eventType") String eventType, @Query("isExpressway") String isExpressway); + +} diff --git a/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/client/GuideTrafficIntercepto.java b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/client/GuideTrafficIntercepto.java new file mode 100644 index 000000000..44a13660e --- /dev/null +++ b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/client/GuideTrafficIntercepto.java @@ -0,0 +1,33 @@ +package org.dromara.guide.client; + +import com.dtflys.forest.http.ForestRequest; +import com.dtflys.forest.interceptor.Interceptor; +import lombok.extern.slf4j.Slf4j; +import org.dromara.common.core.utils.SpringUtils; + +/** + * 请求拦截 请求前添加key + * + * @author AprilWind + */ +@Slf4j +public class GuideTrafficIntercepto implements Interceptor { + + private static final String KEY = SpringUtils.getProperty("client.guide.clientKey"); + + /** + * 该方法在请求发送之前被调用, 若返回false则不会继续发送请求 + * + * @param request Forest请求对象 + */ + @Override + public boolean beforeExecute(ForestRequest request) { + // 用户在高德开放平台官网申请Web服务API类型KEY + request.addQuery("clientKey", KEY); + // 时间戳:秒时间,例如1621243952 单位秒 + request.addQuery("timestamp", System.currentTimeMillis() / 1000); + // 根据授权密钥计算出的动态鉴权信息 + request.addQuery("digest", "鉴权动态密钥"); + return true; + } +} diff --git a/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/GuideEntity.java b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/GuideEntity.java new file mode 100644 index 000000000..9bccb412e --- /dev/null +++ b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/GuideEntity.java @@ -0,0 +1,44 @@ +package org.dromara.guide.domain; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; + +/** + * 高德基类 + * + * @author AprilWind + */ +@Data +public class GuideEntity implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 返回结果状态值(0表示失败;1表示成功) + */ + @JsonProperty("status") + private int status; + + /** + * 返回状态说明(如果成功返回"ok",失败返回错误原因,具体见错误码说明) + */ + @JsonProperty("info") + private String info; + + /** + * 返回状态说明(10000代表正确,详情参阅info状态表) + */ + @JsonProperty("infocode") + private int infocode; + + /** + * 返回结果数目 + */ + @JsonProperty("count") + private int count; + +} diff --git a/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/GuideErrEntity.java b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/GuideErrEntity.java new file mode 100644 index 000000000..42b2fcc41 --- /dev/null +++ b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/GuideErrEntity.java @@ -0,0 +1,39 @@ +package org.dromara.guide.domain; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; + +/** + * 高德基类 + * + * @author AprilWind + */ +@Data +public class GuideErrEntity implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 错误码 + * 30001错误表示抓路失败。当传入点数较少或较稀疏时,可能会导致抓路失败。 + */ + @JsonProperty("errcode") + private int errcode; + + /** + * 错误详情 + */ + @JsonProperty("errdetail") + private String errdetail; + + /** + * 错误信息 + */ + @JsonProperty("errmsg") + private String errmsg; + +} diff --git a/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/bo/DrivingBo.java b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/bo/DrivingBo.java new file mode 100644 index 000000000..63a5706c4 --- /dev/null +++ b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/bo/DrivingBo.java @@ -0,0 +1,52 @@ +package org.dromara.guide.domain.bo; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 轨迹纠偏 + * + * @author AprilWind + */ +@NoArgsConstructor +@Data +public class DrivingBo { + + /** + * 经度 + * 小数点后最多6位 + */ + @JsonProperty("x") + private double x; + + /** + * 纬度 + * 小数点后最多6位 + */ + @JsonProperty("y") + private double y; + + /** + * 角度 + * 与正北方向的夹角,小数、整数均可 + * 需要注意的是,计算时需要参考到设备的角度来判别方向,如果 ag 参数是0,或者是不合法的参数,会比较大概率导致纠偏计算失败。 + */ + @JsonProperty("ag") + private double ag; + + /** + * 时间 + * tm以秒为单位,第一个采集点的tm值从1970年0点开始,其他采集点为与第一个采集点时间的差值 + */ + @JsonProperty("tm") + private long tm; + + /** + * 速度 + * 车辆/设备的移动速度,单位:km/h ,小数、整数均可,在计算纠偏时如果速度值不合理,会比较大概率导致纠偏计算失败。在使用时请传入合理的速度值。 + */ + @JsonProperty("sp") + private double sp; + +} diff --git a/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/BicyclingVo.java b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/BicyclingVo.java new file mode 100644 index 000000000..94367affe --- /dev/null +++ b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/BicyclingVo.java @@ -0,0 +1,131 @@ +package org.dromara.guide.domain.vo; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.dromara.guide.domain.GuideErrEntity; + +import java.util.List; + +/** + * 骑行路径规划 + * + * @author AprilWind + */ +@NoArgsConstructor +@Data +public class BicyclingVo extends GuideErrEntity { + + /** + * 数据体 + */ + @JsonProperty("data") + private BicyclingData data; + + /** + * 数据体实体类 + */ + @NoArgsConstructor + @Data + public static class BicyclingData { + + /** + * 起点坐标,格式:X,Y + */ + @JsonProperty("origin") + private String origin; + + /** + * 终点坐标,格式:X,Y + */ + @JsonProperty("destination") + private String destination; + + /** + * 骑行方案列表信息 + */ + @JsonProperty("paths") + private List paths; + } + + /** + * 骑行方案类 + */ + @NoArgsConstructor + @Data + public static class Path { + + /** + * 起终点的骑行距离,单位:米 + */ + @JsonProperty("distance") + private int distance; + + /** + * 起终点的骑行时间,单位:秒 + */ + @JsonProperty("duration") + private int duration; + + /** + * 具体骑行结果列表 + */ + @JsonProperty("steps") + private List steps; + } + + /** + * 具体骑行结果类 + */ + @NoArgsConstructor + @Data + public static class Step { + /** + * 路段骑行指示,例如:“骑行54米右转” + */ + @JsonProperty("instruction") + private String instruction; + + /** + * 此段路道路名称,可能为空 + */ + @JsonProperty("road") + private String road; + + /** + * 此段路骑行距离,单位:米 + */ + @JsonProperty("distance") + private int distance; + + /** + * 此段路骑行方向,例如:“南” + */ + @JsonProperty("orientation") + private String orientation; + + /** + * 此段路骑行耗时,单位:秒 + */ + @JsonProperty("duration") + private int duration; + + /** + * 此段路骑行的坐标点,格式:X,Y;X1,Y1;X2,Y2 + */ + @JsonProperty("polyline") + private String polyline; + + /** + * 此段路骑行主要动作,可能为空,也可能为左转、右转、向左前方行驶、向右前方行驶等 + */ + @JsonProperty("action") + private String action; + + /** + * 此段路骑行辅助动作,例如:“到达目的地” + */ + @JsonProperty("assistant_action") + private String assistantAction; + } +} diff --git a/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/CircleVo.java b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/CircleVo.java new file mode 100644 index 000000000..cd23ebd44 --- /dev/null +++ b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/CircleVo.java @@ -0,0 +1,139 @@ +package org.dromara.guide.domain.vo; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.dromara.guide.domain.GuideEntity; + +/** + * 圆形区域内交通态势信息 + * + * @author AprilWind + */ +@NoArgsConstructor +@Data +public class CircleVo extends GuideEntity { + + /** + * 交通态势信息 + */ + @JsonProperty("trafficinfo") + private TrafficDetails data; + + /** + * 交通态势详细信息 + */ + @NoArgsConstructor + @Data + public static class TrafficDetails { + + /** + * 路况综述 + */ + @JsonProperty("description") + private String description; + + /** + * 路况评价 + */ + @JsonProperty("evaluation") + private String evaluation; + + /** + * 畅通所占百分比 + */ + @JsonProperty("expedite") + private int expedite; + + /** + * 缓行所占百分比 + */ + @JsonProperty("congested") + private int congested; + + /** + * 拥堵所占百分比 + */ + @JsonProperty("blocked") + private int blocked; + + /** + * 未知路段所占百分比 + */ + @JsonProperty("unknown") + private int unknown; + + /** + * 路况 + * 0:未知;1:畅通;2:缓行;3:拥堵 + */ + @JsonProperty("status") + private int status; + + /** + * 道路描述 + */ + @JsonProperty("description") + private String roadDescription; + + /** + * 道路列表 + */ + @JsonProperty("roads") + private Road[] roads; + } + + /** + * 道路信息 + */ + @NoArgsConstructor + @Data + public static class Road { + + /** + * 道路名称 + */ + @JsonProperty("name") + private String name; + + /** + * 路况 + * 0:未知;1:畅通;2:缓行;3:拥堵 + */ + @JsonProperty("status") + private int status; + + /** + * 方向描述 + */ + @JsonProperty("direction") + private String direction; + + /** + * 车行角度,判断道路正反向使用 + * 以正东方向为0度,逆时针方向为正,取值范围:[0,360] + */ + @JsonProperty("angle") + private int angle; + + /** + * 负值表示反方向 + */ + @JsonProperty("lcodes") + private int[] lcodes; + + /** + * 平均速度 + * 单位:km/hr,四舍五入取整 + */ + @JsonProperty("speed") + private int speed; + + /** + * 道路坐标集,坐标集合 + * 经度和纬度使用","分隔,坐标之间使用";"分隔。例如:x1,y1;x2,y2 + */ + @JsonProperty("polyline") + private String polyline; + } +} diff --git a/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/CoordinateConversionVo.java b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/CoordinateConversionVo.java new file mode 100644 index 000000000..639e0d269 --- /dev/null +++ b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/CoordinateConversionVo.java @@ -0,0 +1,23 @@ +package org.dromara.guide.domain.vo; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.dromara.guide.domain.GuideEntity; + +/** + * 坐标转换结果 + * + * @author AprilWind + */ +@NoArgsConstructor +@Data +public class CoordinateConversionVo extends GuideEntity { + + /** + * 转换之后的坐标。若有多个坐标,则用 “;” 进行区分和间隔 + */ + @JsonProperty("locations") + private String locations; + +} diff --git a/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/DistanceVo.java b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/DistanceVo.java new file mode 100644 index 000000000..3d78393e3 --- /dev/null +++ b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/DistanceVo.java @@ -0,0 +1,68 @@ +package org.dromara.guide.domain.vo; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.dromara.guide.domain.GuideEntity; + +import java.util.List; + +/** + * 距离计算 + * + * @author AprilWind + */ +@NoArgsConstructor +@Data +public class DistanceVo extends GuideEntity { + + /** + * 距离信息列表 + */ + @JsonProperty("results") + private List data; + + /** + * 距离信息 + */ + @NoArgsConstructor + @Data + public static class DistanceInfo { + + /** + * 起点坐标序列号(从1开始) + */ + @JsonProperty("origin_id") + private int originId; + + /** + * 终点坐标序列号(从1开始) + */ + @JsonProperty("dest_id") + private int destId; + + /** + * 路径距离,单位:米 + */ + @JsonProperty("distance") + private int distance; + + /** + * 预计行驶时间,单位:秒 + */ + @JsonProperty("duration") + private int duration; + + /** + * 仅在出错时显示的信息,大部分情况下为"未知错误" + */ + @JsonProperty("info") + private String info; + + /** + * 仅在出错时显示的错误码 + */ + @JsonProperty("code") + private int code; + } +} diff --git a/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/DistrictVo.java b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/DistrictVo.java new file mode 100644 index 000000000..711a8e4e8 --- /dev/null +++ b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/DistrictVo.java @@ -0,0 +1,100 @@ +package org.dromara.guide.domain.vo; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.dromara.guide.domain.GuideEntity; + +import java.util.List; + +/** + * 行政区域 + * + * @author AprilWind + */ +@NoArgsConstructor +@Data +public class DistrictVo extends GuideEntity { + + /** + * 建议结果列表 + */ + @JsonProperty("suggestion") + private Suggestion suggestion; + + /** + * 行政区列表 + */ + @JsonProperty("districts") + private List districts; + + /** + * 建议结果 + */ + @NoArgsConstructor + @Data + public static class Suggestion { + + /** + * 建议关键字列表 + */ + @JsonProperty("keywords") + private List keywords; + + /** + * 建议城市列表 + */ + @JsonProperty("cities") + private List cities; + } + + /** + * 行政区信息 + */ + @NoArgsConstructor + @Data + public static class District { + /** + * 城市编码 + */ + @JsonProperty("citycode") + private String citycode; + + /** + * 区域编码 + */ + @JsonProperty("adcode") + private String adcode; + + /** + * 行政区名称 + */ + @JsonProperty("name") + private String name; + + /** + * 行政区边界坐标点 + */ + @JsonProperty("polyline") + private String polyline; + + /** + * 区域中心点 + */ + @JsonProperty("center") + private String center; + + /** + * 行政区划级别,国家、省份、市、区县、街道 + */ + @JsonProperty("level") + private String level; + + /** + * 下级行政区列表 + */ + @JsonProperty("districts") + private List districts; + + } +} diff --git a/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/DrivingV3Vo.java b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/DrivingV3Vo.java new file mode 100644 index 000000000..faf142464 --- /dev/null +++ b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/DrivingV3Vo.java @@ -0,0 +1,211 @@ +package org.dromara.guide.domain.vo; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.dromara.guide.domain.GuideEntity; + +import java.util.List; + +/** + * 驾车路径规划 + * + * @author AprilWind + */ +@NoArgsConstructor +@Data +public class DrivingV3Vo extends GuideEntity { + + /** + * 驾车路径规划信息列表 + */ + @JsonProperty("route") + private List data; + + /** + * 驾车路径规划信息类 + */ + @NoArgsConstructor + @Data + public static class Route { + + /** + * 起点坐标,规则: lon,lat(经度,纬度), “,”分割,如117.500244, 40.417801 经纬度小数点不超过6位 + */ + @JsonProperty("origin") + private String origin; + + /** + * 终点坐标,规则: lon,lat(经度,纬度), “,”分割,如117.500244, 40.417801 经纬度小数点不超过6位 + */ + @JsonProperty("destination") + private String destination; + + /** + * 打车费用,单位:元,注意:extensions=all时才会返回 + */ + @JsonProperty("taxi_cost") + private double taxiCost; + + /** + * 驾车换乘方案列表 + */ + @JsonProperty("paths") + private List pathList; + + } + + /** + * 驾车换乘方案类 + */ + @NoArgsConstructor + @Data + public static class Path { + /** + * 行驶距离,单位:米 + */ + @JsonProperty("distance") + private int distance; + + /** + * 预计行驶时间,单位:秒 + */ + @JsonProperty("duration") + private int duration; + + /** + * 导航策略 + */ + @JsonProperty("strategy") + private String strategy; + + /** + * 此导航方案道路收费,单位:元 + */ + @JsonProperty("tolls") + private double tolls; + + /** + * 限行结果,0 代表限行已规避或未限行,1 代表限行无法规避 + */ + @JsonProperty("restriction") + private int restriction; + + /** + * 红绿灯个数 + */ + @JsonProperty("traffic_lights") + private int trafficLights; + + /** + * 收费路段距离 + */ + @JsonProperty("toll_distance") + private int tollDistance; + + /** + * 导航路段列表 + */ + @JsonProperty("steps") + private List stepList; + + } + + /** + * 导航路段类 + */ + @NoArgsConstructor + @Data + public static class Step { + /** + * 行驶指示 + */ + @JsonProperty("instruction") + private String instruction; + + /** + * 方向 + */ + @JsonProperty("orientation") + private String orientation; + + /** + * 道路名称 + */ + @JsonProperty("road") + private String road; + + /** + * 此路段距离,单位:米 + */ + @JsonProperty("distance") + private int distance; + + /** + * 此段收费,单位:元 + */ + @JsonProperty("tolls") + private double tolls; + + /** + * 收费路段距离,单位:米 + */ + @JsonProperty("toll_distance") + private int tollDistance; + + /** + * 主要收费道路 + */ + @JsonProperty("toll_road") + private String tollRoad; + + /** + * 此路段坐标点串,格式为坐标串,如:116.481247,39.990704;116.481270,39.990726 + */ + @JsonProperty("polyline") + private String polyline; + + /** + * 导航主要动作 + */ + @JsonProperty("action") + private String action; + + /** + * 导航辅助动作 + */ + @JsonProperty("assistant_action") + private String assistantAction; + + /** + * 驾车导航详细信息列表 + */ + @JsonProperty("tmcs") + private List tmcList; + } + + /** + * 驾车导航详细信息类 + */ + @NoArgsConstructor + @Data + public static class Tmc { + /** + * 此段路的长度,单位:米 + */ + @JsonProperty("distance") + private int distance; + + /** + * 此段路的交通情况,可能取值为未知、畅通、缓行、拥堵、严重拥堵 + */ + @JsonProperty("status") + private String status; + + /** + * 此段路的轨迹,规格:x1,y1;x2,y2 + */ + @JsonProperty("polyline") + private String polyline; + } +} diff --git a/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/DrivingV4Vo.java b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/DrivingV4Vo.java new file mode 100644 index 000000000..802a66b77 --- /dev/null +++ b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/DrivingV4Vo.java @@ -0,0 +1,192 @@ +package org.dromara.guide.domain.vo; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.dromara.guide.domain.GuideEntity; + +import java.util.List; + +/** + * 未来路径规划 + * + * @author AprilWind + */ +@NoArgsConstructor +@Data +public class DrivingV4Vo extends GuideEntity { + + /** + * 返回结果数据 + */ + @JsonProperty("data") + private DrivingData data; + + /** + * 返回结果数据 + */ + @NoArgsConstructor + @Data + public static class DrivingData { + + /** + * 路径规划方案列表 + */ + @JsonProperty("paths") + private List paths; + + /** + * 不同时间的规划以及信息列表 + */ + @JsonProperty("time_infos") + private List timeInfos; + + } + + /** + * 路径规划方案 + */ + @NoArgsConstructor + @Data + public static class Path { + + /** + * 行驶距离,单位:米 + */ + @JsonProperty("distance") + private int distance; + + /** + * 红绿灯个数 + */ + @JsonProperty("traffic_lights") + private int trafficLights; + + /** + * 导航路段列表 + */ + @JsonProperty("steps") + private List steps; + } + + /** + * 导航路段 + */ + @NoArgsConstructor + @Data + public static class Step { + + /** + * 途径区域的区域代码 + */ + @JsonProperty("adcode") + private String adcode; + + /** + * 道路名称 + */ + @JsonProperty("road") + private String road; + + /** + * 路段距离 + */ + @JsonProperty("distance") + private int distance; + + /** + * 道路属性字段,是否收费,0:不收费,1:收费。 + */ + @JsonProperty("toll") + private int toll; + + /** + * 路段坐标点串 + */ + @JsonProperty("polyline") + private String polyline; + + } + + /** + * 不同时间的规划以及信息 + */ + @NoArgsConstructor + @Data + public static class TimeInfo { + + /** + * 出发时间,Unix 时间戳精确到毫秒 + */ + @JsonProperty("starttime") + private long starttime; + + /** + * 路线列表 + */ + @JsonProperty("elements") + private List elements; + + } + + /** + * 路线 + */ + @NoArgsConstructor + @Data + public static class Element { + + /** + * 对应的路线 + */ + @JsonProperty("pathindex") + private int pathindex; + + /** + * 总时长,单位:分钟 + */ + @JsonProperty("duration") + private int duration; + + /** + * 总收费,单位:元 + */ + @JsonProperty("tolls") + private double tolls; + + /** + * 限行状态,0:代表限行已规避或未限行,1:代表限行无法规避 + */ + @JsonProperty("restriction") + private int restriction; + + /** + * 路况信息列表 + */ + @JsonProperty("tmcs") + private List tmcs; + + } + + /** + * 路况信息 + */ + @NoArgsConstructor + @Data + public static class Tmc { + + /** + * 路况状态 + */ + @JsonProperty("status") + private int status; + + /** + * 路段坐标点 + */ + @JsonProperty("polyline") + private String polyline; + + } + +} diff --git a/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/DrivingVo.java b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/DrivingVo.java new file mode 100644 index 000000000..1e739cb04 --- /dev/null +++ b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/DrivingVo.java @@ -0,0 +1,64 @@ +package org.dromara.guide.domain.vo; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.dromara.guide.domain.GuideErrEntity; + +import java.util.List; + +/** + * 轨迹纠偏 + * + * @author AprilWind + */ +@NoArgsConstructor +@Data +public class DrivingVo extends GuideErrEntity { + + /** + * 数据体 + */ + @JsonProperty("data") + private DrivingData data; + + /** + * 数据体实体类 + */ + @NoArgsConstructor + @Data + public static class DrivingData { + + /** + * 总距离 + */ + @JsonProperty("distance") + private double distance; + + /** + * 返回坐标合集 + */ + @JsonProperty("points") + private List points; + + /** + * 坐标点实体类 + */ + @NoArgsConstructor + @Data + public static class Point { + + /** + * 经度 + */ + @JsonProperty("x") + private double x; + + /** + * 纬度 + */ + @JsonProperty("y") + private double y; + } + } +} diff --git a/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/GeocodeVo.java b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/GeocodeVo.java new file mode 100644 index 000000000..1b5388727 --- /dev/null +++ b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/GeocodeVo.java @@ -0,0 +1,94 @@ +package org.dromara.guide.domain.vo; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.dromara.guide.domain.GuideEntity; + +import java.util.List; + +/** + * 地理编码 + * + * @author AprilWind + */ +@NoArgsConstructor +@Data +public class GeocodeVo extends GuideEntity { + + /** + * 地理编码信息列表,结果对象列表 + */ + @JsonProperty("geocodes") + private List data; + + /** + * 地理编码信息列表 + */ + @NoArgsConstructor + @Data + public static class Geocode { + + /** + * 国家,默认返回中国 + */ + @JsonProperty("country") + private String country; + + /** + * 地址所在的省份名,例如:北京市 + * 注意:中国的四大直辖市也算作省级单位 + */ + @JsonProperty("province") + private String province; + + /** + * 地址所在的城市名,例如:北京市 + */ + @JsonProperty("city") + private String city; + + /** + * 城市编码,例如:010 + */ + @JsonProperty("citycode") + private String citycode; + + /** + * 地址所在的区,例如:朝阳区 + */ + @JsonProperty("district") + private String district; + + /** + * 街道,例如:阜通东大街 + */ + @JsonProperty("street") + private String street; + + /** + * 门牌,例如:6号 + */ + @JsonProperty("number") + private String number; + + /** + * 区域编码,例如:110101 + */ + @JsonProperty("adcode") + private String adcode; + + /** + * 坐标点,经度,纬度 + */ + @JsonProperty("location") + private String location; + + /** + * 匹配级别,参见地理编码匹配级别列表 + */ + @JsonProperty("level") + private String level; + } + +} diff --git a/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/GeohubVo.java b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/GeohubVo.java new file mode 100644 index 000000000..b050d8764 --- /dev/null +++ b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/GeohubVo.java @@ -0,0 +1,84 @@ +package org.dromara.guide.domain.vo; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.dromara.guide.domain.GuideEntity; + +import java.util.List; + +/** + * 三方数据空间检索结果 + * + * @author AprilWind + */ +@NoArgsConstructor +@Data +public class GeohubVo extends GuideEntity { + + /** + * 符合关键字筛选条件的数据对象 + */ + @JsonProperty("objects") + private GeohubResults data; + + /** + * 符合关键字筛选条件的数据对象 + */ + @NoArgsConstructor + @Data + public static class GeohubResults { + + /** + * 点/线/面对象 + */ + @JsonProperty("geometry") + private Geometry geometry; + + /** + * 属性 + */ + @JsonProperty("properties") + private List properties; + } + + /** + * 点/线/面对象 + */ + @NoArgsConstructor + @Data + public static class Geometry { + + /** + * 坐标信息 + */ + @JsonProperty("coordinates") + private List coordinates; + + /** + * 类型:point/polyline/polygon/multipoint/multipolyline/multipolygon + */ + @JsonProperty("type") + private String type; + } + + /** + * 属性 + */ + @NoArgsConstructor + @Data + public static class GeohubPrertie { + /** + * 属性名称 + */ + @JsonProperty("name") + private String name; + + /** + * 属性值 + */ + @JsonProperty("value") + private Object value; + } + +} diff --git a/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/InputtipsVo.java b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/InputtipsVo.java new file mode 100644 index 000000000..44b34fc4b --- /dev/null +++ b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/InputtipsVo.java @@ -0,0 +1,71 @@ +package org.dromara.guide.domain.vo; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.dromara.guide.domain.GuideEntity; + +import java.util.List; + +/** + * 提示信息 + * + * @author AprilWind + */ +@NoArgsConstructor +@Data +public class InputtipsVo extends GuideEntity { + + /** + * 建议提示列表 + */ + @JsonProperty("tips") + private List data; + + /** + * 建议提示 + */ + @NoArgsConstructor + @Data + public static class Tip { + /** + * 提示信息ID + * 若数据为POI类型,则返回POI ID;若数据为bus类型,则返回bus id;若数据为busline类型,则返回busline id。 + */ + @JsonProperty("id") + private String id; + + /** + * 提示信息名称 + */ + @JsonProperty("name") + private String name; + + /** + * 所属区域 + * 省+市+区(直辖市为“市+区”) + */ + @JsonProperty("district") + private String district; + + /** + * 区域编码 + * 六位区县编码 + */ + @JsonProperty("adcode") + private String adcode; + + /** + * 提示中心点坐标 + * 当搜索数据为busline类型时,此字段不返回 + */ + @JsonProperty("location") + private String location; + + /** + * 详细地址 + */ + @JsonProperty("address") + private String address; + } +} diff --git a/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/IntegratedVo.java b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/IntegratedVo.java new file mode 100644 index 000000000..37c50f124 --- /dev/null +++ b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/IntegratedVo.java @@ -0,0 +1,526 @@ +package org.dromara.guide.domain.vo; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.dromara.guide.domain.GuideEntity; + +import java.util.List; + +/** + * 公交路径规划 + * + * @author AprilWind + */ +@NoArgsConstructor +@Data +public class IntegratedVo extends GuideEntity { + + /** + * 公交换乘信息列表 + */ + @JsonProperty("route") + private List routeList; + + /** + * 公交换乘信息类 + */ + @NoArgsConstructor + @Data + public static class Route { + + /** + * 起点坐标 + */ + @JsonProperty("origin") + private String origin; + + /** + * 终点坐标 + */ + @JsonProperty("destination") + private String destination; + + /** + * 起点和终点的步行距离,单位:米 + */ + @JsonProperty("distance") + private int distance; + + /** + * 出租车费用,单位:元 + */ + @JsonProperty("taxi_cost") + private double taxiCost; + + /** + * 公交换乘方案列表 + */ + @JsonProperty("transits") + private List transitList; + + } + + /** + * 公交换乘方案类 + */ + @NoArgsConstructor + @Data + public static class Transit { + + /** + * 此换乘方案价格,单位:元 + */ + @JsonProperty("cost") + private double cost; + + /** + * 此换乘方案预期时间,单位:秒 + */ + @JsonProperty("duration") + private int duration; + + /** + * 是否是夜班车 + * 0:非夜班车;1:夜班车 + */ + @JsonProperty("nightflag") + private int nightFlag; + + /** + * 此方案总步行距离,单位:米 + */ + @JsonProperty("walking_distance") + private int walkingDistance; + + /** + * 换乘路段列表 + */ + @JsonProperty("segments") + private List segmentList; + + } + + /** + * 换乘路段类 + */ + @NoArgsConstructor + @Data + public static class Segment { + + /** + * 步行导航信息 + */ + @JsonProperty("walking") + private List walking; + + /** + * 公交导航信息 + */ + @JsonProperty("bus") + private List bus; + + /** + * 地铁入口 + */ + @JsonProperty("entrance") + private List entrance; + + /** + * 地铁出口 + */ + @JsonProperty("exit") + private List exit; + + /** + * 乘坐火车的信息 + */ + @JsonProperty("railway") + private List railway; + } + + /** + * 步行导航信息 + */ + @NoArgsConstructor + @Data + public static class Walking { + /** + * 起点坐标 + */ + @JsonProperty("origin") + private String origin; + + /** + * 终点坐标 + */ + @JsonProperty("destination") + private String destination; + + /** + * 起点和终点的步行距离,单位:米 + */ + @JsonProperty("distance") + private int distance; + + /** + * 步行预计时间,单位:秒 + */ + @JsonProperty("duration") + private int duration; + + /** + * 步行路段列表 + */ + @JsonProperty("steps") + private List stepList; + + /** + * 步行路段类 + */ + @NoArgsConstructor + @Data + public static class Step { + /** + * 此段路的行走介绍 + */ + @JsonProperty("instruction") + private String instruction; + + /** + * 路的名字 + */ + @JsonProperty("road") + private String road; + + /** + * 此段路的距离,单位:米 + */ + @JsonProperty("distance") + private int distance; + + /** + * 此段路预计消耗时间,单位:秒 + */ + @JsonProperty("duration") + private int duration; + + /** + * 此段路的坐标 + */ + @JsonProperty("polyline") + private String polyline; + + /** + * 步行主要动作 + */ + @JsonProperty("action") + private String action; + + /** + * 步行辅助动作 + */ + @JsonProperty("assistant_action") + private String assistantAction; + } + } + + /** + * 公交导航信息 + */ + @NoArgsConstructor + @Data + public static class Bus { + + /** + * 步行路段列表 + */ + @JsonProperty("buslines") + private List busLines; + + /** + * 公交路线类 + */ + @NoArgsConstructor + @Data + public static class BusLine { + /** + * 此段起乘站信息 + */ + @JsonProperty("departure_stop") + private Stop departureStop; + + /** + * 此段下车站 + */ + @JsonProperty("arrival_stop") + private Stop arrivalStop; + + /** + * 公交路线名称 + */ + @JsonProperty("name") + private String name; + + /** + * 公交路线id + */ + @JsonProperty("id") + private String id; + + /** + * 公交类型 + */ + @JsonProperty("type") + private String type; + + /** + * 公交行驶距离,单位:米 + */ + @JsonProperty("distance") + private int distance; + + /** + * 公交预计行驶时间,单位:秒 + */ + @JsonProperty("duration") + private int duration; + + /** + * 此路段坐标集 + */ + @JsonProperty("polyline") + private String polyline; + + /** + * 首班车时间,格式如:0600,代表06:00 + */ + @JsonProperty("start_time") + private String startTime; + + /** + * 末班车时间,格式如:2300,代表23:00 + */ + @JsonProperty("end_time") + private String endTime; + + /** + * 此段途经公交站数 + */ + @JsonProperty("via_num") + private int viaNum; + + /** + * 此段途经公交站点列表 + */ + @JsonProperty("via_stops") + private List viaStops; + + /** + * 公交站点类 + */ + public static class Stop { + /** + * 途径公交站点信息 + */ + @JsonProperty("name") + private String name; + + /** + * 公交站点编号 + */ + @JsonProperty("id") + private String id; + + /** + * 公交站点经纬度 + */ + @JsonProperty("location") + private String location; + } + } + } + + /** + * 地铁出入口 + */ + @NoArgsConstructor + @Data + public static class Entrance { + + /** + * 经纬度 + */ + @JsonProperty("location") + private String location; + + } + + /** + * 乘坐火车的信息 + */ + @NoArgsConstructor + @Data + public static class Railway { + /** + * 线路id编号 + */ + @JsonProperty("id") + private String id; + + /** + * 该线路车段耗时 + */ + @JsonProperty("time") + private String time; + + /** + * 线路名称 + */ + @JsonProperty("name") + private String name; + + /** + * 线路车次号 + */ + @JsonProperty("trip") + private String trip; + + /** + * 该item换乘段的行车总距离 + */ + @JsonProperty("distance") + private String distance; + + /** + * 线路车次类型 + */ + @JsonProperty("type") + private String type; + + /** + * 火车始发站信息 + */ + @JsonProperty("departure_stop") + private StopInfo departureStop; + + /** + * 火车到站信息 + */ + @JsonProperty("arrival_stop") + private StopInfo arrivalStop; + + /** + * 途径站点信息 + */ + @JsonProperty("via_stop") + private List viaStops; + + /** + * 聚合的备选方案 + */ + @JsonProperty("alters") + private List alters; + + /** + * 仓位及价格信息 + */ + @JsonProperty("spaces") + private List spaces; + + + /** + * 火车到站信息 + */ + @NoArgsConstructor + @Data + public static class StopInfo { + /** + * 站点ID + */ + @JsonProperty("id") + private String id; + + /** + * 站点名称 + */ + @JsonProperty("name") + private String name; + + /** + * 站点经纬度 + */ + @JsonProperty("location") + private String location; + + /** + * 站点所在城市的adcode + */ + @JsonProperty("adcode") + private String adcode; + + /** + * 时间信息 + */ + @JsonProperty("time") + private String time; + + /** + * 是否为起始站或终点站,1表示是,0表示否 + */ + @JsonProperty("start") + private int start; + + /** + * 是否为终点站,1表示是,0表示否 + */ + @JsonProperty("end") + private int end; + + } + + + /** + * 聚合的备选方案 + */ + @NoArgsConstructor + @Data + public static class AlternativeRoute { + + /** + * 备选方案ID + */ + @JsonProperty("id") + private String id; + + /** + * 备选线路名称 + */ + @JsonProperty("name") + private String name; + + } + + /** + * 仓位及价格信息 + */ + @NoArgsConstructor + @Data + public static class SpaceInfo { + + /** + * 仓位编码 + */ + @JsonProperty("code") + private String code; + + /** + * 仓位费用 + */ + @JsonProperty("cost") + private String cost; + + } + } + +} diff --git a/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/IpLocationVo.java b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/IpLocationVo.java new file mode 100644 index 000000000..f2a977844 --- /dev/null +++ b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/IpLocationVo.java @@ -0,0 +1,41 @@ +package org.dromara.guide.domain.vo; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.dromara.guide.domain.GuideEntity; + +/** + * IP定位 + * + * @author AprilWind + */ +@NoArgsConstructor +@Data +public class IpLocationVo extends GuideEntity { + + /** + * 省份名称,若为直辖市则显示直辖市名称;如果在局域网IP网段内,则返回“局域网”;非法IP以及国外IP则返回空 + */ + @JsonProperty("province") + private String province; + + /** + * 城市名称,若为直辖市则显示直辖市名称;如果为局域网网段内IP或者非法IP或国外IP,则返回空 + */ + @JsonProperty("city") + private String city; + + /** + * 城市的adcode编码 + */ + @JsonProperty("adcode") + private String adcode; + + /** + * 所在城市矩形区域范围,所在城市范围的左下右上对标对 + */ + @JsonProperty("rectangle") + private String rectangle; + +} diff --git a/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/LineidVo.java b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/LineidVo.java new file mode 100644 index 000000000..0604daeb6 --- /dev/null +++ b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/LineidVo.java @@ -0,0 +1,189 @@ +package org.dromara.guide.domain.vo; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.dromara.guide.domain.GuideEntity; + +import java.util.List; + +/** + * 公交路线信息 + * + * @author AprilWind + */ +@NoArgsConstructor +@Data +public class LineidVo extends GuideEntity { + + /** + * 公交线路信息列表 + */ + @JsonProperty("buslines") + private List data; + + /** + * 公交线路信息类 + */ + @NoArgsConstructor + @Data + public static class BusLine { + /** + * 公交线路id + */ + @JsonProperty("id") + private String id; + + /** + * 公交类型 + */ + @JsonProperty("type") + private String type; + + /** + * 线路名称 + */ + @JsonProperty("name") + private String name; + + /** + * 坐标串 + */ + @JsonProperty("polyline") + private String polyline; + + /** + * 城市的citycode + */ + @JsonProperty("citycode") + private String citycode; + + /** + * 首发站 + */ + @JsonProperty("start_stop") + private String startStop; + + /** + * 末站 + */ + @JsonProperty("end_stop") + private String endStop; + + /** + * 首班车时间 + */ + @JsonProperty("start_time") + private String startTime; + + /** + * 末班车时间 + */ + @JsonProperty("end_time") + private String endTime; + + /** + * 线路 ui 颜色 + */ + @JsonProperty("uicolor") + private String uiColor; + + /** + * 线路详细时间 + */ + @JsonProperty("timedesc") + private String timeDesc; + + /** + * 全程里程,单位:公里 + */ + @JsonProperty("distance") + private double distance; + + /** + * 是否环线,0:否,1:是 + */ + @JsonProperty("loop") + private int loop; + + /** + * 线路状态,0:停运,1:正常,2:规划中,3:在建 + */ + @JsonProperty("status") + private int status; + + /** + * 反向线路id,如果有反向线路,则记录对向线路,如果没有反向线路,则记录自身 + */ + @JsonProperty("direc") + private String direction; + + /** + * 所属公司 + */ + @JsonProperty("company") + private String company; + + /** + * 线路长度,单位:公里 + */ + @JsonProperty("distance") + private double lineDistance; + + /** + * 起步价,单位:元 + */ + @JsonProperty("basic_price") + private double basicPrice; + + /** + * 全程票价,单位:元 + */ + @JsonProperty("total_price") + private double totalPrice; + + /** + * 矩形区域 + */ + @JsonProperty("bounds") + private String bounds; + + /** + * 途径站列表 + */ + @JsonProperty("busstops") + private List busstops; + } + + /** + * 途径站信息类 + */ + @NoArgsConstructor + @Data + public static class BusStop { + /** + * 公交站ID + */ + @JsonProperty("id") + private String id; + + /** + * 公交站名 + */ + @JsonProperty("name") + private String name; + + /** + * 公交站经纬度 + */ + @JsonProperty("location") + private String location; + + /** + * 公交站序号 + */ + @JsonProperty("sequence") + private int sequence; + } + +} diff --git a/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/LinenameVo.java b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/LinenameVo.java new file mode 100644 index 000000000..3a1f9c90b --- /dev/null +++ b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/LinenameVo.java @@ -0,0 +1,74 @@ +package org.dromara.guide.domain.vo; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.dromara.guide.domain.GuideEntity; + +import java.util.List; + +/** + * 公交路线信息 + * + * @author AprilWind + */ +@NoArgsConstructor +@Data +public class LinenameVo extends GuideEntity { + + /** + * 公交路线的集合 + */ + @JsonProperty("buslines") + private List data; + + /** + * 公交路 + */ + @NoArgsConstructor + @Data + public static class BusLine { + + /** + * 唯一id + */ + @JsonProperty("id") + private String id; + + /** + * 公交类型 + */ + @JsonProperty("type") + private String type; + + /** + * 线路名称 + */ + @JsonProperty("name") + private String name; + + /** + * 线路的坐标串 + */ + @JsonProperty("polyline") + private String polyline; + + /** + * 城市的adcode + */ + @JsonProperty("citycode") + private String citycode; + + /** + * 始发站 + */ + @JsonProperty("start_stop") + private String startStop; + + /** + * 终点站 + */ + @JsonProperty("end_stop") + private String endStop; + } +} diff --git a/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/PolylineVo.java b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/PolylineVo.java new file mode 100644 index 000000000..120987168 --- /dev/null +++ b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/PolylineVo.java @@ -0,0 +1,112 @@ +package org.dromara.guide.domain.vo; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.dromara.guide.domain.GuideEntity; + +import java.util.List; + +/** + * AOI边界 + * + * @author AprilWind + */ +@NoArgsConstructor +@Data +public class PolylineVo extends GuideEntity { + + /** + * aoi返回的详细数据列表 + */ + @JsonProperty("aois") + private List data; + + /** + * aoi返回的详细数据 + */ + @NoArgsConstructor + @Data + public static class AOI { + + /** + * aoi名称 + */ + @JsonProperty("name") + private String name; + + /** + * aoi唯一标识 + */ + @JsonProperty("id") + private String id; + + /** + * aoi中心点经纬度 + */ + @JsonProperty("location") + private String location; + + /** + * 边界经纬度坐标串,以“_”分隔 + */ + @JsonProperty("polyline") + private String polyline; + + /** + * aoi所属分类 + */ + @JsonProperty("type") + private String type; + + /** + * aoi分类编码 + */ + @JsonProperty("typecode") + private String typecode; + + /** + * aoi所属省份 + */ + @JsonProperty("pname") + private String pname; + + /** + * aoi所属城市 + */ + @JsonProperty("cityname") + private String cityname; + + /** + * aoi所属区域 + */ + @JsonProperty("adname") + private String adname; + + /** + * aoi详细地址 + */ + @JsonProperty("address") + private String address; + + /** + * aoi所属省份编码 + */ + @JsonProperty("pcode") + private String pcode; + + /** + * aoi所属城市编码 + */ + @JsonProperty("citycode") + private String citycode; + + /** + * aoi所属区域编码 + */ + @JsonProperty("adcode") + private String adcode; + + } + +} diff --git a/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/Position2Vo.java b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/Position2Vo.java new file mode 100644 index 000000000..680eaa581 --- /dev/null +++ b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/Position2Vo.java @@ -0,0 +1,125 @@ +package org.dromara.guide.domain.vo; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.dromara.guide.domain.GuideEntity; + +import java.util.List; + +/** + * 智能硬件定位Vo 2.0 + * + * @author AprilWind + */ +@NoArgsConstructor +@Data +public class Position2Vo extends GuideEntity { + + /** + * 返回的定位结果列表 + */ + @JsonProperty("position") + private List position; + + /** + * 可选差异化结果返回 + */ + @JsonProperty("show_fields") + private String showFields; + + /** + * 结构化地址信息 + */ + @JsonProperty("formatted_address") + private String formattedAddress; + + /** + * 地址元素列表 + */ + @JsonProperty("addressComponent") + private List addressComponent; + + /** + * 定位结果 + */ + @NoArgsConstructor + @Data + public static class Position { + + /** + * 定位结果坐标 + * 如:116.473168,39.993015 + */ + @JsonProperty("location") + private String location; + + /** + * 定位精度半径,单位:米 + */ + @JsonProperty("radius") + private int radius; + } + + /** + * 地址元素 + */ + @NoArgsConstructor + @Data + public static class AddressComponent { + + /** + * 国 + */ + @JsonProperty("country") + private String country; + + /** + * 省 + */ + @JsonProperty("province") + private String province; + + /** + * 市 + */ + @JsonProperty("city") + private String city; + + /** + * 区 + */ + @JsonProperty("district") + private String district; + + /** + * 城市编码 + */ + @JsonProperty("citycode") + private String citycode; + + /** + * 区域编码 + */ + @JsonProperty("adcode") + private String adcode; + + /** + * 附近街道名称 + */ + @JsonProperty("street") + private String street; + + /** + * 周边道路名称 + */ + @JsonProperty("road") + private String road; + + /** + * 周边 POI 名称 + */ + @JsonProperty("poi") + private String poi; + } +} diff --git a/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/PositionVo.java b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/PositionVo.java new file mode 100644 index 000000000..3e07d1ddf --- /dev/null +++ b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/PositionVo.java @@ -0,0 +1,107 @@ +package org.dromara.guide.domain.vo; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.dromara.guide.domain.GuideEntity; + +import java.util.List; + +/** + * 智能硬件定位Vo + * + * @author AprilWind + */ +@NoArgsConstructor +@Data +public class PositionVo extends GuideEntity { + + /** + * 定位结果列表 + */ + @JsonProperty("result") + private List data; + + /** + * 定位结果 + */ + @NoArgsConstructor + @Data + public static class LocationItem { + + /** + * 定位类型 + * 0:没有得到定位结果; + * 其他数字为:正常获取定位结果 + */ + @JsonProperty("type") + private int type; + + /** + * 手机 imei 号 + */ + @JsonProperty("imei") + private String imei; + + /** + * 定位经纬度 + */ + @JsonProperty("location") + private String location; + + /** + * 定位精度半径,单位:米 + */ + @JsonProperty("radius") + private double radius; + + /** + * 位置描述 + */ + @JsonProperty("desc") + private String desc; + + /** + * 国家 + */ + @JsonProperty("country") + private String country; + + /** + * 省份 + */ + @JsonProperty("province") + private String province; + + /** + * 城市 + */ + @JsonProperty("city") + private String city; + + /** + * 城市编码 + */ + @JsonProperty("citycode") + private String citycode; + + /** + * 区域编码 + */ + @JsonProperty("adcode") + private String adcode; + + /** + * 道路名 + */ + @JsonProperty("road") + private String road; + + /** + * 定位附近的 poi 名称 + */ + @JsonProperty("poi") + private String poi; + + } +} diff --git a/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/RectangleVo.java b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/RectangleVo.java new file mode 100644 index 000000000..30f644299 --- /dev/null +++ b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/RectangleVo.java @@ -0,0 +1,150 @@ +package org.dromara.guide.domain.vo; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.dromara.guide.domain.GuideEntity; + +import java.util.List; + +/** + * 矩形区域内交通态势信息 + * + * @author AprilWind + */ +@NoArgsConstructor +@Data +public class RectangleVo extends GuideEntity { + + /** + * 交通态势信息 + */ + @JsonProperty("trafficinfo") + public Trafficinfo data; + + /** + * 交通态势信息 + */ + @NoArgsConstructor + @Data + public static class Trafficinfo { + + /** + * 路况综述 + */ + @JsonProperty("description") + private String description; + + /** + * 路况评价 + */ + @JsonProperty("evaluation") + private Evaluation evaluation; + + /** + * 道路列表 + */ + @JsonProperty("roads") + private List roads; + } + + /** + * 路况评价 + */ + @NoArgsConstructor + @Data + public static class Evaluation { + + /** + * 畅通所占百分比 + */ + @JsonProperty("expedite") + private int expedite; + + /** + * 缓行所占百分比 + */ + @JsonProperty("congested") + private int congested; + + /** + * 拥堵所占百分比 + */ + @JsonProperty("blocked") + private int blocked; + + /** + * 未知路段所占百分比 + */ + @JsonProperty("unknown") + private int unknown; + + /** + * 路况 + * 0:未知;1:畅通;2:缓行;3:拥堵 + */ + @JsonProperty("status") + private int status; + + /** + * 道路描述 + */ + @JsonProperty("description") + private String roadDescription; + } + + + /** + * 道路列表 + */ + @NoArgsConstructor + @Data + public static class Road { + + /** + * 道路名称 + */ + @JsonProperty("name") + private String name; + + /** + * 路况 + * 0:未知;1:畅通;2:缓行;3:拥堵 + */ + @JsonProperty("status") + private int status; + + /** + * 方向描述 + */ + @JsonProperty("direction") + private String direction; + + /** + * 车行角度,判断道路正反向使用 + * 以正东方向为0度,逆时针方向为正,取值范围:[0,360] + */ + @JsonProperty("angle") + private int angle; + + /** + * 负值表示反方向 + */ + @JsonProperty("lcodes") + private int[] lcodes; + + /** + * 平均速度 + * 单位:km/hr,四舍五入取整 + */ + @JsonProperty("speed") + private int speed; + + /** + * 道路坐标集,坐标集合 + * 经度和纬度使用","分隔,坐标之间使用";"分隔。例如:x1,y1;x2,y2 + */ + @JsonProperty("polyline") + private String polyline; + } +} diff --git a/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/ReverseGeocodingVo.java b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/ReverseGeocodingVo.java new file mode 100644 index 000000000..a321fcc81 --- /dev/null +++ b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/ReverseGeocodingVo.java @@ -0,0 +1,468 @@ +package org.dromara.guide.domain.vo; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.dromara.guide.domain.GuideEntity; + +import java.util.List; + +/** + * 逆地理编码 + * + * @author AprilWind + */ +@NoArgsConstructor +@Data +public class ReverseGeocodingVo extends GuideEntity { + + /** + * 逆地理编码列表 + */ + @JsonProperty("regeocode") + private Regeocode data; + + + /** + * 逆地理编码列表 + */ + @NoArgsConstructor + @Data + public class Regeocode { + + /** + * + */ + @JsonProperty("formatted_address") + private String formattedAddress; + + /** + * 地址元素列表 + */ + @JsonProperty("addressComponent") + private AddressComponent addressComponent; + + /** + * 社区信息列表 + */ + @JsonProperty("neighborhood") + private Neighborhood neighborhood; + + /** + * 楼信息列表 + */ + @JsonProperty("building") + private Building building; + + /** + * 门牌信息列表 + */ + @JsonProperty("streetNumber") + private StreetNumber streetNumber; + + /** + * 经纬度所属商圈列表 + */ + @JsonProperty("businessAreas") + private List businessAreas; + + /** + * poi信息列表 + */ + @JsonProperty("pois") + private List pois; + + /** + * 道路信息列表 + */ + @JsonProperty("roads") + private List roads; + + /** + * 道路交叉口列表 + */ + @JsonProperty("roadinters") + private List roadinters; + + /** + * aoi信息列表 + */ + @JsonProperty("aois") + private List aois; + + } + + /** + * 地址元素列表 + */ + @NoArgsConstructor + @Data + public static class AddressComponent { + + /** + * 坐标点所在国家名称 例如:中国 + */ + @JsonProperty("country") + private String country; + + /** + * 坐标点所在省名称 例如:北京市 + */ + @JsonProperty("province") + private String province; + + /** + * 坐标点所在城市名称 请注意:当城市是省直辖县时返回为空,以及城市为北京、上海、天津、重庆四个直辖市时,该字段返回为空;省直辖县列表 + */ + @JsonProperty("city") + private List city; + + /** + * 城市编码 例如:010 + */ + @JsonProperty("citycode") + private String citycode; + + /** + * 坐标点所在区 例如:海淀区 + */ + @JsonProperty("district") + private String district; + + /** + * 行政区编码 例如:110108 + */ + @JsonProperty("adcode") + private String adcode; + + /** + * 坐标点所在乡镇/街道(此街道为社区街道,不是道路信息) 例如:燕园街道 + */ + @JsonProperty("township") + private String township; + + /** + * 乡镇街道编码 例如:110101001000 + */ + @JsonProperty("towncode") + private String towncode; + + } + + /** + * 社区信息列表 + */ + @NoArgsConstructor + @Data + public static class Neighborhood { + + /** + * 社区名称 例如:北京大学 + */ + @JsonProperty("name") + private String name; + + /** + * POI类型 例如:科教文化服务;学校;高等院校 + */ + @JsonProperty("type") + private String type; + + } + + /** + * 楼信息列表 + */ + @NoArgsConstructor + @Data + public static class Building { + + /** + * 建筑名称 例如:万达广场 + */ + @JsonProperty("name") + private String name; + + /** + * 类型 例如:科教文化服务;学校;高等院校 + */ + @JsonProperty("type") + private String type; + + } + + /** + * 门牌信息列表 + */ + @NoArgsConstructor + @Data + public static class StreetNumber { + + /** + * 街道名称 例如:中关村北二条 + */ + @JsonProperty("street") + private String street; + + /** + * 门牌号 例如:3号 + */ + @JsonProperty("number") + private String number; + + /** + * 坐标点 经纬度坐标点:经度,纬度 + */ + @JsonProperty("location") + private String location; + + /** + * 方向 坐标点所处街道方位 + */ + @JsonProperty("direction") + private String direction; + + /** + * 门牌地址到请求坐标的距离 单位:米 + */ + @JsonProperty("distance") + private String distance; + + } + + /** + * 商圈信息 + */ + @NoArgsConstructor + @Data + public static class BusinessArea { + + /** + * 商圈中心点经纬度 + */ + @JsonProperty("location") + private String location; + + /** + * 商圈名称 例如:颐和园 + */ + @JsonProperty("name") + private String name; + + /** + * 商圈所在区域的adcode 例如:朝阳区/海淀区 + */ + @JsonProperty("id") + private String id; + + } + + /** + * poi信息 + */ + @NoArgsConstructor + @Data + public class POI { + + /** + * poi的id + */ + @JsonProperty("id") + private String id; + + /** + * poi点名称 + */ + @JsonProperty("name") + private String name; + + /** + * poi类型 + */ + @JsonProperty("type") + private String type; + + /** + * 电话 + */ + @JsonProperty("tel") + private String tel; + + /** + * 该POI的中心点到请求坐标的距离 单位:米 + */ + @JsonProperty("direction") + private String direction; + + /** + * 方向 为输入点相对建筑物的方位 + */ + @JsonProperty("distance") + private String distance; + + /** + * poi地址信息 + */ + @JsonProperty("location") + private String location; + + /** + * 坐标点 + */ + @JsonProperty("address") + private String address; + + /** + * + */ + @JsonProperty("poiweight") + private String poiweight; + + /** + * poi所在商圈名称 + */ + @JsonProperty("businessarea") + private String businessarea; + + } + + /** + * 道路信息 + */ + @NoArgsConstructor + @Data + public static class Road { + + /** + * 道路id + */ + @JsonProperty("id") + private String id; + + /** + * 道路名称 + */ + @JsonProperty("name") + private String name; + + /** + * 道路到请求坐标的距离 单位:米 + */ + @JsonProperty("direction") + private String direction; + + /** + * 方位 输入点和此路的相对方位 + */ + @JsonProperty("distance") + private String distance; + + /** + * 坐标点 + */ + @JsonProperty("location") + private String location; + + } + + /** + * 道路交叉口 + */ + @NoArgsConstructor + @Data + public static class RoadIntersection { + + /** + * 交叉路口到请求坐标的距离 单位:米 + */ + @JsonProperty("direction") + private String direction; + + /** + * 方位 输入点相对路口的方位 + */ + @JsonProperty("distance") + private String distance; + + /** + * 路口经纬度 + */ + @JsonProperty("location") + private String location; + + /** + * 第一条道路id + */ + @JsonProperty("first_id") + private String firstId; + + /** + * 第一条道路名称 + */ + @JsonProperty("first_name") + private String firstName; + + /** + * 第二条道路id + */ + @JsonProperty("second_id") + private String secondId; + + /** + * 第二条道路名称 + */ + @JsonProperty("second_name") + private String secondName; + + } + + /** + * aoi信息 + */ + @NoArgsConstructor + @Data + public static class AOI { + + /** + * 所属 aoi的id + */ + @JsonProperty("id") + private String id; + + /** + * 所属 aoi 名称 + */ + @JsonProperty("name") + private String name; + + /** + * 所属 aoi 所在区域编码 + */ + @JsonProperty("adcode") + private String adcode; + + /** + * 所属 aoi 中心点坐标 + */ + @JsonProperty("location") + private String location; + + /** + * 所属aoi点面积 单位:平方米 + */ + @JsonProperty("area") + private String area; + + /** + * 输入经纬度是否在aoi面之中 0,代表在aoi内其余整数代表距离AOI的距离 + */ + @JsonProperty("distance") + private String distance; + + /** + * 所属 aoi 类型 + */ + @JsonProperty("type") + private String type; + } +} diff --git a/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/RoadVo.java b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/RoadVo.java new file mode 100644 index 000000000..8ac1d8611 --- /dev/null +++ b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/RoadVo.java @@ -0,0 +1,127 @@ +package org.dromara.guide.domain.vo; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.dromara.guide.domain.GuideEntity; + +import java.util.List; + +/** + * 指定线路交通态势信息 + * + * @author AprilWind + */ +@NoArgsConstructor +@Data +public class RoadVo extends GuideEntity { + + /** + * 交通态势信息 + */ + @JsonProperty("trafficinfo") + private List data; + + /** + * 交通态势详细信息 + */ + @NoArgsConstructor + @Data + public static class TrafficDetails { + /** + * 路况综述 + */ + @JsonProperty("description") + private String description; + + /** + * 路况评价 + */ + @JsonProperty("evaluation") + private String evaluation; + + /** + * 畅通所占百分比 + */ + @JsonProperty("expedite") + private int expedite; + + /** + * 缓行所占百分比 + */ + @JsonProperty("congested") + private int congested; + + /** + * 拥堵所占百分比 + */ + @JsonProperty("blocked") + private int blocked; + + /** + * 未知路段所占百分比 + */ + @JsonProperty("unknown") + private int unknown; + + /** + * 路况列表 + */ + @JsonProperty("roads") + private Road[] roads; + } + + /** + * 道路信息 + */ + @NoArgsConstructor + @Data + public static class Road { + + /** + * 道路名称 + */ + @JsonProperty("name") + private String name; + + /** + * 路况 + * 0:未知; 1:畅通; 2:缓行; 3:拥堵 + */ + @JsonProperty("status") + private int status; + + /** + * 方向描述 + */ + @JsonProperty("direction") + private String direction; + + /** + * 车行角度 + * 以正东方向为0度,逆时针方向为正,取值范围:[0,360] + */ + @JsonProperty("angle") + private int angle; + + /** + * 负值表示反方向 + */ + @JsonProperty("lcodes") + private int[] lcodes; + + /** + * 平均速度 + * 单位:km/hr,四舍五入取整 + */ + @JsonProperty("speed") + private int speed; + + /** + * 道路坐标集 + * 坐标集合,经度和纬度使用","分隔,坐标之间使用";"分隔。例如:x1,y1;x2,y2 + */ + @JsonProperty("polyline") + private String polyline; + } +} diff --git a/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/StopidVo.java b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/StopidVo.java new file mode 100644 index 000000000..04e18e7aa --- /dev/null +++ b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/StopidVo.java @@ -0,0 +1,107 @@ +package org.dromara.guide.domain.vo; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.dromara.guide.domain.GuideEntity; + +import java.util.List; + +/** + * 公交站信息 + * + * @author AprilWind + */ +@NoArgsConstructor +@Data +public class StopidVo extends GuideEntity { + + /** + * 公交车站信息列表 + */ + @JsonProperty("busstops") + private List data; + + /** + * 公交车站信息 + */ + @NoArgsConstructor + @Data + public static class BusStop { + + /** + * 公交站id + */ + @JsonProperty("id") + private String id; + + /** + * 公交站名 + */ + @JsonProperty("name") + private String name; + + /** + * 经纬度 + */ + @JsonProperty("location") + private String location; + + /** + * 城市adcode + */ + @JsonProperty("adcode") + private String adcode; + + /** + * 城市citycode + */ + @JsonProperty("citycode") + private String citycode; + + /** + * 途径此站的公交路线列表 + */ + @JsonProperty("buslines") + private List buslines; + } + + /** + * 公交路线信息类 + */ + @NoArgsConstructor + @Data + public static class BusLine { + + /** + * 公交线路唯一id + */ + @JsonProperty("id") + private String id; + + /** + * 公交线路途径此站的经纬度 + */ + @JsonProperty("location") + private String location; + + /** + * 线路名称 + */ + @JsonProperty("name") + private String name; + + /** + * 首发站 + */ + @JsonProperty("start_stop") + private String startStop; + + /** + * 末站 + */ + @JsonProperty("end_stop") + private String endStop; + } + +} diff --git a/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/TextVo.java b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/TextVo.java new file mode 100644 index 000000000..d8bcfaccb --- /dev/null +++ b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/TextVo.java @@ -0,0 +1,421 @@ +package org.dromara.guide.domain.vo; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.dromara.guide.domain.GuideEntity; + +import java.util.List; + +/** + * 搜索POI + * + * @author AprilWind + */ +@NoArgsConstructor +@Data +public class TextVo extends GuideEntity { + + /** + * 建议提示列表 + */ + @JsonProperty("suggestion") + private Suggestion suggestion; + + /** + * POI信息列表 + */ + @JsonProperty("pois") + private List pois; + + /** + * 基于城市的建议实体类 + */ + @NoArgsConstructor + @Data + public static class Suggestion { + + /** + * 关键字 + */ + @JsonProperty("keywords") + private List keywords; + + /** + * 城市建议列表 + */ + @JsonProperty("cities") + private List cities; + } + + /** + * 城市信息 + */ + @NoArgsConstructor + @Data + public static class City { + + /** + * 城市名称 + */ + @JsonProperty("name") + private String name; + + /** + * 关键字数目 + */ + @JsonProperty("num") + private int num; + + /** + * 该城市的citycode + */ + @JsonProperty("citycode") + private String citycode; + + /** + * 该城市的adcode + */ + @JsonProperty("adcode") + private String adcode; + } + + /** + * POI信息实体类 + */ + @NoArgsConstructor + @Data + public static class Poi { + + /** + * 唯一ID + */ + @JsonProperty("id") + private String id; + + /** + * 父POI的ID + * 当前POI如果有父POI,则返回父POI的ID。可能为空 + */ + @JsonProperty("parent") + private String parent; + + /** + * 名称 + */ + @JsonProperty("name") + private String name; + + /** + * 兴趣点类型 + * 顺序为大类、中类、小类 + * 例如:餐饮服务;中餐厅;特色/地方风味餐厅 + */ + @JsonProperty("type") + private String type; + + /** + * 兴趣点类型编码 + * 例如:050118 + */ + @JsonProperty("typecode") + private String typecode; + + /** + * 行业类型 + */ + @JsonProperty("biz_type") + private String bizType; + + /** + * 地址 + */ + @JsonProperty("address") + private String address; + + /** + * 经纬度 + * 格式:X,Y + */ + @JsonProperty("location") + private String location; + + /** + * 离中心点距离 + * 单位:米;仅在周边搜索的时候有值返回 + */ + @JsonProperty("distance") + private int distance; + + /** + * POI的电话 + */ + @JsonProperty("tel") + private String tel; + + /** + * 邮编 + * extensions=all时返回 + */ + @JsonProperty("postcode") + private String postcode; + + /** + * POI的网址 + * extensions=all时返回 + */ + @JsonProperty("website") + private String website; + + /** + * POI的电子邮箱 + * extensions=all时返回 + */ + @JsonProperty("email") + private String email; + + /** + * POI所在省份编码 + * extensions=all时返回 + */ + @JsonProperty("pcode") + private String pcode; + + /** + * POI所在省份名称 + * 若是直辖市的时候,此处直接显示市名,例如北京市 + */ + @JsonProperty("pname") + private String pname; + + /** + * 城市编码 + * extensions=all时返回 + */ + @JsonProperty("citycode") + private String citycode; + + /** + * 城市名 + * 若是直辖市的时候,此处直接显示市名,例如北京市 + */ + @JsonProperty("cityname") + private String cityname; + + /** + * 区域编码 + * extensions=all时返回 + */ + @JsonProperty("adcode") + private String adcode; + + /** + * 区域名称 + * 区县级别的返回,例如朝阳区 + */ + @JsonProperty("adname") + private String adname; + + /** + * POI的入口经纬度 + * extensions=all时返回,也可用作于POI的到达点; + */ + @JsonProperty("entr_location") + private String entrLocation; + + /** + * POI的出口经纬度 + * 目前不会返回内容; + */ + @JsonProperty("exit_location") + private String exitLocation; + + /** + * POI导航id + * extensions=all时返回 + */ + @JsonProperty("navi_poiid") + private String naviPoiid; + + /** + * 地理格ID + * extensions=all时返回 + */ + @JsonProperty("gridcode") + private String gridcode; + + /** + * 别名 + * extensions=all时返回 + */ + @JsonProperty("alias") + private String alias; + + /** + * 停车场类型 + * 仅在停车场类型POI的时候显示该字段 + * 展示停车场类型,包括:地下、地面、路边 + * extensions=all的时候显示 + */ + @JsonProperty("parking_type") + private String parkingType; + + /** + * 该POI的特色内容 + * 主要出现在美食类POI中,代表特色菜 + * 例如“烤鱼,麻辣香锅,老干妈回锅肉” + * extensions=all时返回 + */ + @JsonProperty("tag") + private String tag; + + /** + * 是否有室内地图标志 + * 1,表示有室内相关数据 + * 0,代表没有室内相关数据 + * extensions=all时返回 + */ + @JsonProperty("indoor_map") + private int indoorMap; + + /** + * 团购数据 + * 此字段逐渐废弃 + */ + @JsonProperty("groupbuy_num") + private int groupbuyNum; + + /** + * 所属商圈 + * extensions=all时返回 + */ + @JsonProperty("business_area") + private String businessArea; + + /** + * 优惠信息数目 + * 此字段逐渐废弃 + */ + @JsonProperty("discount_num") + private int discountNum; + + /** + * 室内地图相关数据 + * 当 indoor_map=0 时,字段为空 + * extensions=all时返回 + */ + @JsonProperty("indoor_data") + private List indoorData; + + /** + * 深度信息 + * extensions=all时返回 + */ + @JsonProperty("biz_ext") + private List bizExt; + + /** + * 照片相关信息 + */ + @JsonProperty("photos") + private List photos; + } + + + /** + * 室内地图相关数据 + */ + @NoArgsConstructor + @Data + public static class IndoorData { + /** + * 当前POI的父级POI + * 如果当前POI为建筑物类POI,则cpid为自身POI ID; + * 如果当前POI为商铺类POI,则cpid为其所在建筑物的POI ID + */ + @JsonProperty("cpid") + private String cpid; + + /** + * 楼层索引 + * 一般会用数字表示,例如8 + */ + @JsonProperty("floor") + private int floor; + + /** + * 所在楼层 + * 一般会带有字母,例如F8 + */ + @JsonProperty("truefloor") + private String trueFloor; + } + + /** + * 深度信息 + */ + @NoArgsConstructor + @Data + public static class BizExt { + /** + * 评分 + * 仅存在于餐饮、酒店、景点、影院类POI之下 + */ + @JsonProperty("rating") + private double rating; + + /** + * 人均消费 + * 仅存在于餐饮、酒店、景点、影院类POI之下 + */ + @JsonProperty("cost") + private double cost; + + /** + * 是否可订餐 + * 仅存在于餐饮相关POI之下(此字段逐渐废弃) + */ + @JsonProperty("meal_ordering") + private boolean mealOrdering; + + /** + * 是否可选座 + * 仅存在于影院相关POI之下(此字段逐渐废弃) + */ + @JsonProperty("seat_ordering") + private boolean seatOrdering; + + /** + * 是否可订票 + * 仅存在于景点相关POI之下(此字段逐渐废弃) + */ + @JsonProperty("ticket_ordering") + private boolean ticketOrdering; + + /** + * 是否可以订房 + * 仅存在于酒店相关POI之下(此字段逐渐废弃) + */ + @JsonProperty("hotel_ordering") + private boolean hotelOrdering; + } + + /** + * 照片相关信息 + */ + @NoArgsConstructor + @Data + public static class Photo { + /** + * 图片介绍 + */ + @JsonProperty("title") + private String title; + + /** + * 具体链接 + */ + @JsonProperty("url") + private String url; + } +} diff --git a/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/TrafficVo.java b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/TrafficVo.java new file mode 100644 index 000000000..9a7172cfc --- /dev/null +++ b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/TrafficVo.java @@ -0,0 +1,135 @@ +package org.dromara.guide.domain.vo; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +/** + * 交通事件 + * + * @author AprilWind + */ +@NoArgsConstructor +@Data +public class TrafficVo { + + /** + * 调用成功,常见代码: + *

+ * 0:Successful. 成功 + */ + @JsonProperty("code") + private int code; + + /** + * 事件信息 + */ + @JsonProperty("data") + private List data; + + /** + * 事件信息 + */ + @NoArgsConstructor + @Data + public static class TrafficData { + + /** + * 事件简述 + */ + @JsonProperty("brief") + private String brief; + + /** + * 事件预计结束时间 + */ + @JsonProperty("endTime") + private String endTime; + + /** + * 事件描述 + */ + @JsonProperty("eventDesc") + private String eventDesc; + + /** + * 事件ID + */ + @JsonProperty("eventID") + private int eventID; + + /** + * 事件类型 + */ + @JsonProperty("eventType") + private int eventType; + + /** + * 是否高速 + */ + @JsonProperty("expressway") + private int expressway; + + /** + * 线路坐标 + */ + @JsonProperty("lines") + private String lines; + + /** + * 发布方名称 + */ + @JsonProperty("nickName") + private String nickName; + + /** + * 是否权威发布 + */ + @JsonProperty("offcial") + private int offcial; + + /** + * 事件图片链接 + */ + @JsonProperty("picture") + private String picture; + + /** + * 道路名称 + */ + @JsonProperty("roadName") + private String roadName; + + /** + * 数据源编号 + */ + @JsonProperty("source") + private int source; + + /** + * 事件开始时间 + */ + @JsonProperty("startTime") + private String startTime; + + /** + * 事件最后更新时间 + */ + @JsonProperty("updateTime") + private String updateTime; + + /** + * 经度坐标 + */ + @JsonProperty("x") + private double x; + + /** + * 纬度坐标 + */ + @JsonProperty("y") + private double y; + } +} diff --git a/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/WalkingVo.java b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/WalkingVo.java new file mode 100644 index 000000000..2096776a3 --- /dev/null +++ b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/WalkingVo.java @@ -0,0 +1,183 @@ +package org.dromara.guide.domain.vo; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.dromara.guide.domain.GuideEntity; + +import java.util.List; + +/** + * 步行路径规划 + * + * @author AprilWind + */ +@NoArgsConstructor +@Data +public class WalkingVo extends GuideEntity { + + /** + * 路线信息列表 + */ + @JsonProperty("route") + private List routeList; + + /** + * 路线信息类 + */ + @NoArgsConstructor + @Data + public static class Route { + /** + * 起点坐标 + */ + @JsonProperty("origin") + private String origin; + + /** + * 终点坐标 + */ + @JsonProperty("destination") + private String destination; + + /** + * 步行方案列表 + */ + @JsonProperty("paths") + private List pathList; + + } + + /** + * 步行方案类 + */ + @NoArgsConstructor + @Data + public static class Path { + /** + * 起点和终点的步行距离,单位:米 + */ + @JsonProperty("distance") + private int distance; + + /** + * 步行时间预计,单位:秒 + */ + @JsonProperty("duration") + private int duration; + + /** + * 步行结果列表 + */ + @JsonProperty("steps") + private List stepList; + + + } + + /** + * 步行结果类 + */ + @NoArgsConstructor + @Data + public static class Step { + /** + * 路段步行指示 + */ + @JsonProperty("instruction") + private String instruction; + + /** + * 道路名称 + */ + @JsonProperty("road") + private String road; + + /** + * 此路段距离,单位:米 + */ + @JsonProperty("distance") + private int distance; + + /** + * 方向 + */ + @JsonProperty("orientation") + private String orientation; + + /** + * 此路段预计步行时间 + */ + @JsonProperty("duration") + private int duration; + + /** + * 此路段坐标点 + */ + @JsonProperty("polyline") + private String polyline; + + /** + * 步行主要动作 + */ + @JsonProperty("action") + private String action; + + /** + * 步行辅助动作 + */ + @JsonProperty("assistant_action") + private String assistantAction; + + /** + * 步行方式类型 + * 0,普通道路 + *

+ * 1,人行横道 + *

+ * 3,地下通道 + *

+ * 4,过街天桥 + *

+ * 5,地铁通道 + *

+ * 6,公园 + *

+ * 7,广场 + *

+ * 8,扶梯 + *

+ * 9,直梯 + *

+ * 10,索道 + *

+ * 11,空中通道 + *

+ * 12,建筑物穿越通道 + *

+ * 13,行人通道 + *

+ * 14,游船路线 + *

+ * 15,观光车路线 + *

+ * 16,滑道 + *

+ * 18,扩路 + *

+ * 19,道路附属连接线 + *

+ * 20,阶梯 + *

+ * 21,斜坡 + *

+ * 22,桥 + *

+ * 23,隧道 + *

+ * 30,轮渡 + */ + @JsonProperty("walk_type") + private int walkType; + } +} diff --git a/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/WeatherQueryVo.java b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/WeatherQueryVo.java new file mode 100644 index 000000000..ad3396787 --- /dev/null +++ b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/domain/vo/WeatherQueryVo.java @@ -0,0 +1,201 @@ +package org.dromara.guide.domain.vo; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.dromara.guide.domain.GuideEntity; + +import java.util.List; + +/** + * 天气查询 + * + * @author AprilWind + */ +@NoArgsConstructor +@Data +public class WeatherQueryVo extends GuideEntity { + + /** + * 实况天气数据信息 + */ + @JsonProperty("lives") + private List lives; + + /** + * 预报天气信息数据 + */ + @JsonProperty("forecast") + private List forecast; + + /** + * 实况天气信息 + */ + @NoArgsConstructor + @Data + public static class LiveWeather { + + /** + * 省份名 + */ + @JsonProperty("province") + private String province; + + /** + * 城市名 + */ + @JsonProperty("city") + private String city; + + /** + * 区域编码 + */ + @JsonProperty("adcode") + private String adcode; + + /** + * 天气现象(汉字描述) + */ + @JsonProperty("weather") + private String weather; + + /** + * 实时气温,单位:摄氏度 + */ + @JsonProperty("temperature") + private String temperature; + + /** + * 风向描述 + */ + @JsonProperty("winddirection") + private String winddirection; + + /** + * 风力级别,单位:级 + */ + @JsonProperty("windpower") + private String windpower; + + /** + * 空气湿度 + */ + @JsonProperty("humidity") + private String humidity; + + /** + * 数据发布的时间 + */ + @JsonProperty("reporttime") + private String reporttime; + + } + + /** + * 预报天气信息 + */ + @NoArgsConstructor + @Data + public static class ForecastWeather { + + /** + * 城市名称 + */ + @JsonProperty("city") + private String city; + + /** + * 城市编码 + */ + @JsonProperty("adcode") + private String adcode; + + /** + * 省份名称 + */ + @JsonProperty("province") + private String province; + + /** + * 预报发布时间 + */ + @JsonProperty("reporttime") + private String reporttime; + + /** + * 预报数据list结构,元素cast,按顺序为当天、第二天、第三天的预报数据 + */ + @JsonProperty("casts") + private List casts; + + } + + /** + * 预报天气数据实体类 + */ + @NoArgsConstructor + @Data + public static class ForecastData { + + /** + * 日期 + */ + @JsonProperty("date") + private String date; + + /** + * 星期几 + */ + @JsonProperty("week") + private String week; + + /** + * 白天天气现象 + */ + @JsonProperty("dayweather") + private String dayweather; + + /** + * 晚上天气现象 + */ + @JsonProperty("nightweather") + private String nightweather; + + /** + * 白天温度 + */ + @JsonProperty("daytemp") + private String daytemp; + + /** + * 晚上温度 + */ + @JsonProperty("nighttemp") + private String nighttemp; + + /** + * 白天风向 + */ + @JsonProperty("daywind") + private String daywind; + + /** + * 晚上风向 + */ + @JsonProperty("nightwind") + private String nightwind; + + /** + * 白天风力 + */ + @JsonProperty("daypower") + private String daypower; + + /** + * 晚上风力 + */ + @JsonProperty("nightpower") + private String nightpower; + + } +} diff --git a/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/util/GuideUtil.java b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/util/GuideUtil.java new file mode 100644 index 000000000..813ab2ec0 --- /dev/null +++ b/ruoyi-client/ruoyi-client-guide/src/main/java/org/dromara/guide/util/GuideUtil.java @@ -0,0 +1,15 @@ +package org.dromara.guide.util; + +import com.dtflys.forest.Forest; +import org.dromara.guide.client.GuideClient; + +/** + * 高德地图API工具 + * + * @author AprilWind + */ +public class GuideUtil { + private static GuideClient CLIENT = Forest.client(GuideClient.class); + + +} diff --git a/ruoyi-client/ruoyi-client-guide/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/ruoyi-client/ruoyi-client-guide/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 000000000..7df27cd24 --- /dev/null +++ b/ruoyi-client/ruoyi-client-guide/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +org.dromara.guide.config.GuideProperties diff --git a/ruoyi-client/ruoyi-client-guide/src/main/resources/client-guide.yml b/ruoyi-client/ruoyi-client-guide/src/main/resources/client-guide.yml new file mode 100644 index 000000000..8c42de6f6 --- /dev/null +++ b/ruoyi-client/ruoyi-client-guide/src/main/resources/client-guide.yml @@ -0,0 +1,5 @@ +client: + # 高德地图API + guide: + key: 920a2a10bcfa85f561f2018b2474776f + clientKey: 920a2a10bcfa85f561f2018b2474776f From 1f33d10f14a03df3492998e7ffbd016b25a287db Mon Sep 17 00:00:00 2001 From: AprilWind <2100166581@qq.com> Date: Fri, 31 May 2024 16:19:53 +0800 Subject: [PATCH 4/4] =?UTF-8?q?update=20=E4=BC=98=E5=8C=96pom?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 3 --- 1 file changed, 3 deletions(-) diff --git a/pom.xml b/pom.xml index 96ae7ff48..fd8c8c787 100644 --- a/pom.xml +++ b/pom.xml @@ -62,9 +62,6 @@ 1.5.36 - - - 7.0.0