From fd9096bb5b1c48e5b2ef67439d475fa6970ce8b9 Mon Sep 17 00:00:00 2001 From: herodotus Date: Wed, 18 Aug 2021 18:42:40 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20v2.5.4.55=201.=20=E6=95=B4?= =?UTF-8?q?=E5=90=88=E4=BB=A3=E7=A0=81=EF=BC=8C=E5=B0=86constant=E5=8C=85?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=95=B4=E5=90=88=E8=87=B3common=E5=8C=85?= =?UTF-8?q?=E4=B8=AD=E3=80=82=E5=88=A0=E9=99=A4constant=E5=8C=85=E3=80=82?= =?UTF-8?q?=202.=20=E5=AE=8C=E5=96=84Rest=E6=8E=A5=E5=8F=A3=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C=E6=9C=BA=E5=88=B6=EF=BC=8C=E4=BB=A5=E5=8F=8A=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E8=87=AA=E5=AE=9A=E4=B9=89=E9=94=99=E8=AF=AF=E7=A0=81?= =?UTF-8?q?=203.=20=E7=BB=9F=E4=B8=80spring=20boot=20validation=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E4=BF=A1=E6=81=AF=EF=BC=8C=E5=B0=86=E5=85=B6=E6=95=B4?= =?UTF-8?q?=E5=90=88=E8=87=B3=E5=B9=B3=E5=8F=B0=E7=BB=9F=E4=B8=80=E5=93=8D?= =?UTF-8?q?=E5=BA=94=E5=AE=9E=E4=BD=93Result=E4=B8=AD=E3=80=82=E6=97=A0?= =?UTF-8?q?=E9=A1=BB=E5=9C=A8=E5=90=84=E4=B8=AARest=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E4=B8=AD=EF=BC=8C=E6=B7=BB=E5=8A=A0BindingResult=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- .../docker/docker-compose/herodotus/.env | 2 +- dependencies/pom.xml | 7 +- packages/eurynome-cloud-assistant/pom.xml | 8 +- .../annotation/ConditionalOnKafkaEnabled.java | 2 +- .../exception/HerodotusExceptionHandler.java} | 25 +-- .../platform}/IllegalArgumentException.java | 8 +- .../platform}/PlatformException.java | 10 +- .../assistant/utils/PropertyResolver.java | 4 +- packages/eurynome-cloud-common/pom.xml | 44 ++++- .../common}/constant/enums/AccountType.java | 2 +- .../constant/enums/ApplicationType.java | 2 +- .../common}/constant/enums/Architecture.java | 2 +- .../common}/constant/enums/AuthorityType.java | 2 +- .../constant/enums/DataAccessStrategy.java | 2 +- .../common}/constant/enums/GrantType.java | 4 +- .../constant/enums/OAuth2Expression.java | 2 +- .../common}/constant/enums/ProtocolType.java | 2 +- .../common}/constant/enums/ResultStatus.java | 3 +- .../common}/constant/enums/StatusEnum.java | 2 +- .../constant/enums/captcha/CaptchaFont.java | 2 +- .../enums/captcha/CaptchaLetterType.java | 2 +- .../constant/enums/captcha/CaptchaType.java | 2 +- .../constant/magic/CacheConstants.java | 2 +- .../constant/magic/PlatformConstants.java | 2 +- .../constant/magic/PropertyConstants.java | 2 +- .../constant/magic/SecurityConstants.java | 4 +- .../constant/magic/SecurityExpression.java | 2 +- .../constant/magic/ServiceConstants.java | 2 +- .../constant/magic/SymbolConstants.java | 2 +- .../eurynome/common/domain/Error.java | 93 ++++++++++ .../eurynome/common/domain/Result.java | 37 +++- .../eurynome/common/domain/TreeNode.java | 93 ---------- .../deserializer/StatusEnumDeserializer.java | 2 +- .../eurynome/common/utils/ConvertUtils.java | 4 +- .../common/utils/JacksonYamlUtils.java | 2 +- .../eurynome/common/utils/OkHttpUtils.java | 170 ------------------ .../eurynome/common/utils/TreeUtils.java | 79 -------- packages/eurynome-cloud-constant/pom.xml | 76 -------- packages/eurynome-cloud-crud/pom.xml | 4 +- .../BaseReadableRestController.java | 12 +- .../crud/service/AbstractCacheService.java | 2 +- packages/eurynome-cloud-data/pom.xml | 4 +- .../data/base/entity/BaseAppEntity.java | 2 +- .../data/base/entity/BaseSysEntity.java | 2 +- .../data/cache/query/AbstractCache.java | 4 +- .../data/properties/CacheProperties.java | 2 +- .../data/properties/QueueProperties.java | 2 +- packages/eurynome-cloud-kernel/pom.xml | 4 +- .../properties/ManagementProperties.java | 2 +- packages/eurynome-cloud-oauth-starter/pom.xml | 4 +- .../HerodotusOauthClientDetailsService.java | 2 +- packages/eurynome-cloud-oauth/pom.xml | 4 +- .../VerificationCodeController.java | 2 +- .../eurynome/oauth/utils/SymmetricUtils.java | 2 +- .../src/main/resources/templates/error.html | 2 +- packages/eurynome-cloud-rest/pom.xml | 6 +- .../eurynome/rest/base/business/Pager.java | 71 ++++++++ .../configuration/SwaggerConfiguration.java | 4 +- .../rest/properties/PlatformProperties.java | 12 +- .../rest/properties/RestProperties.java | 3 +- .../rest/properties/ServiceProperties.java | 4 +- packages/eurynome-cloud-security/pom.xml | 4 +- .../access/RequestMappingScanner.java | 8 +- .../token/HerodotusJwtTokenEnhancer.java | 2 +- .../SecurityAutoConfiguration.java | 2 + .../definition/domain/RequestMapping.java | 2 +- .../properties/SecurityProperties.java | 10 +- .../SecurityGlobalExceptionHandler.java | 48 ++++- .../service/RequestMappingGatherService.java | 2 +- .../eurynome/security/utils/WebUtils.java | 2 +- packages/eurynome-cloud-starter/pom.xml | 4 +- packages/pom.xml | 3 +- platform/eurynome-cloud-gateway/pom.xml | 4 +- .../GatewayGlobalExceptionHandler.java | 6 +- .../filter/GlobalCertificationFilter.java | 4 +- platform/eurynome-cloud-management/pom.xml | 4 +- platform/eurynome-cloud-uaa/pom.xml | 4 +- platform/pom.xml | 2 +- pom.xml | 4 +- services/eurynome-cloud-bpmn-ability/pom.xml | 4 +- services/eurynome-cloud-bpmn-rest/pom.xml | 4 +- services/eurynome-cloud-upms-ability/pom.xml | 4 +- services/eurynome-cloud-upms-api/pom.xml | 4 +- .../upms/api/constants/UpmsConstants.java | 10 +- .../api/entity/oauth/OauthClientDetails.java | 2 +- .../upms/api/entity/system/SysAuthority.java | 2 +- .../api/entity/system/SysDefaultRole.java | 2 +- .../eurynome/upms/api/helper/UpmsHelper.java | 4 +- services/eurynome-cloud-upms-logic/pom.xml | 4 +- .../system/SysAuthorityRepository.java | 2 +- .../system/SysDefaultRoleRepository.java | 2 +- .../service/system/SysAuthorityService.java | 2 +- .../service/system/SysDefaultRoleService.java | 2 +- services/eurynome-cloud-upms-rest/pom.xml | 4 +- .../system/SysAuthorityController.java | 18 +- services/pom.xml | 2 +- 97 files changed, 440 insertions(+), 616 deletions(-) rename packages/{eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/exception/GlobalExceptionHandler.java => eurynome-cloud-assistant/src/main/java/cn/herodotus/eurynome/assistant/exception/HerodotusExceptionHandler.java} (94%) rename packages/{eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/exception => eurynome-cloud-assistant/src/main/java/cn/herodotus/eurynome/assistant/exception/platform}/IllegalArgumentException.java (87%) rename packages/{eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/exception => eurynome-cloud-assistant/src/main/java/cn/herodotus/eurynome/assistant/exception/platform}/PlatformException.java (85%) rename packages/{eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome => eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common}/constant/enums/AccountType.java (99%) rename packages/{eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome => eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common}/constant/enums/ApplicationType.java (98%) rename packages/{eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome => eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common}/constant/enums/Architecture.java (95%) rename packages/{eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome => eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common}/constant/enums/AuthorityType.java (98%) rename packages/{eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome => eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common}/constant/enums/DataAccessStrategy.java (95%) rename packages/{eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome => eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common}/constant/enums/GrantType.java (95%) rename packages/{eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome => eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common}/constant/enums/OAuth2Expression.java (98%) rename packages/{eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome => eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common}/constant/enums/ProtocolType.java (96%) rename packages/{eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome => eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common}/constant/enums/ResultStatus.java (98%) rename packages/{eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome => eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common}/constant/enums/StatusEnum.java (98%) rename packages/{eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome => eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common}/constant/enums/captcha/CaptchaFont.java (96%) rename packages/{eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome => eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common}/constant/enums/captcha/CaptchaLetterType.java (95%) rename packages/{eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome => eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common}/constant/enums/captcha/CaptchaType.java (94%) rename packages/{eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome => eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common}/constant/magic/CacheConstants.java (97%) rename packages/{eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome => eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common}/constant/magic/PlatformConstants.java (95%) rename packages/{eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome => eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common}/constant/magic/PropertyConstants.java (98%) rename packages/{eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome => eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common}/constant/magic/SecurityConstants.java (95%) rename packages/{eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome => eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common}/constant/magic/SecurityExpression.java (95%) rename packages/{eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome => eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common}/constant/magic/ServiceConstants.java (95%) rename packages/{eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome => eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common}/constant/magic/SymbolConstants.java (98%) create mode 100644 packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/domain/Error.java delete mode 100644 packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/domain/TreeNode.java delete mode 100644 packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/utils/OkHttpUtils.java delete mode 100644 packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/utils/TreeUtils.java delete mode 100644 packages/eurynome-cloud-constant/pom.xml create mode 100644 packages/eurynome-cloud-rest/src/main/java/cn/herodotus/eurynome/rest/base/business/Pager.java diff --git a/README.md b/README.md index 7992f852e..0f8dbc7a5 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Nacos 2.0.3 License Apache 2.0 码匠君 - Version 2.5.4.50 + Version 2.5.4.55 Gitee star Gitee fork

diff --git a/configurations/docker/docker-compose/herodotus/.env b/configurations/docker/docker-compose/herodotus/.env index 9c6a7af0d..04702d7d4 100644 --- a/configurations/docker/docker-compose/herodotus/.env +++ b/configurations/docker/docker-compose/herodotus/.env @@ -1,4 +1,4 @@ -VERSION=2.5.4.50 +VERSION=2.5.4.55 GATEWAY_SERVICE_NAME=eurynome-cloud-gateway GATEWAY_SERVICE_PORT=8847 UAA_SERVICE_NAME=eurynome-cloud-uaa diff --git a/dependencies/pom.xml b/dependencies/pom.xml index e1f7db388..9aacc209f 100644 --- a/dependencies/pom.xml +++ b/dependencies/pom.xml @@ -35,7 +35,7 @@ cn.herodotus.eurynome dependencies - 2.5.4.50 + 2.5.4.55 pom eurynome-cloud-dependencies @@ -124,11 +124,6 @@ ${spring-boot-admin.version} - - ${project.groupId} - eurynome-cloud-constant - ${project.version} - ${project.groupId} eurynome-cloud-common diff --git a/packages/eurynome-cloud-assistant/pom.xml b/packages/eurynome-cloud-assistant/pom.xml index 35fff5220..ee30e63f3 100644 --- a/packages/eurynome-cloud-assistant/pom.xml +++ b/packages/eurynome-cloud-assistant/pom.xml @@ -27,7 +27,7 @@ packages cn.herodotus.eurynome - 2.5.4.50 + 2.5.4.55 4.0.0 @@ -47,7 +47,7 @@ org.springframework.boot - spring-boot-starter + spring-boot-starter-validation @@ -55,9 +55,5 @@ spring-cloud-starter-bus-kafka - - org.springframework.cloud - spring-cloud-stream-binder-kafka - \ No newline at end of file diff --git a/packages/eurynome-cloud-assistant/src/main/java/cn/herodotus/eurynome/assistant/annotation/ConditionalOnKafkaEnabled.java b/packages/eurynome-cloud-assistant/src/main/java/cn/herodotus/eurynome/assistant/annotation/ConditionalOnKafkaEnabled.java index 4f27d9d32..767dff272 100644 --- a/packages/eurynome-cloud-assistant/src/main/java/cn/herodotus/eurynome/assistant/annotation/ConditionalOnKafkaEnabled.java +++ b/packages/eurynome-cloud-assistant/src/main/java/cn/herodotus/eurynome/assistant/annotation/ConditionalOnKafkaEnabled.java @@ -22,7 +22,7 @@ package cn.herodotus.eurynome.assistant.annotation; -import cn.herodotus.eurynome.constant.magic.PropertyConstants; +import cn.herodotus.eurynome.common.constant.magic.PropertyConstants; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import java.lang.annotation.*; diff --git a/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/exception/GlobalExceptionHandler.java b/packages/eurynome-cloud-assistant/src/main/java/cn/herodotus/eurynome/assistant/exception/HerodotusExceptionHandler.java similarity index 94% rename from packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/exception/GlobalExceptionHandler.java rename to packages/eurynome-cloud-assistant/src/main/java/cn/herodotus/eurynome/assistant/exception/HerodotusExceptionHandler.java index fc814e97f..c3f8005e6 100644 --- a/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/exception/GlobalExceptionHandler.java +++ b/packages/eurynome-cloud-assistant/src/main/java/cn/herodotus/eurynome/assistant/exception/HerodotusExceptionHandler.java @@ -20,13 +20,14 @@ * Date: 2021/05/07 11:28:07 */ -package cn.herodotus.eurynome.common.exception; +package cn.herodotus.eurynome.assistant.exception; +import cn.herodotus.eurynome.common.constant.enums.ResultStatus; import cn.herodotus.eurynome.common.domain.Result; -import cn.herodotus.eurynome.constant.enums.ResultStatus; -import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.apache.http.HttpStatus; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.HashMap; import java.util.Map; @@ -36,8 +37,9 @@ * * @author gengwei.zheng */ -@Slf4j -public class GlobalExceptionHandler { +public class HerodotusExceptionHandler { + + private static final Logger log = LoggerFactory.getLogger(HerodotusExceptionHandler.class); private static final Map> EXCEPTION_DICTIONARY = new HashMap<>(); @@ -112,6 +114,8 @@ public class GlobalExceptionHandler { // 6*.** 对应错误 EXCEPTION_DICTIONARY.put("BadSqlGrammarException", getResult(ResultStatus.BAD_SQL_GRAMMAR)); EXCEPTION_DICTIONARY.put("DataIntegrityViolationException", getResult(ResultStatus.DATA_INTEGRITY_VIOLATION)); + EXCEPTION_DICTIONARY.put("BindException", getValidationResult(ResultStatus.METHOD_ARGUMENT_NOT_VALID)); + EXCEPTION_DICTIONARY.put("MethodArgumentNotValidException", getValidationResult(ResultStatus.METHOD_ARGUMENT_NOT_VALID)); // 7*.** 对应错误 EXCEPTION_DICTIONARY.put("RedisPipelineException", getResult(ResultStatus.PIPELINE_INVALID_COMMANDS, HttpStatus.SC_INTERNAL_SERVER_ERROR)); // 以下是没有重新梳理过的错误。 @@ -136,9 +140,6 @@ public class GlobalExceptionHandler { EXCEPTION_DICTIONARY.put("HttpMediaTypeNotAcceptableException", getBadRequestResult(ResultStatus.MEDIA_TYPE_NOT_ACCEPTABLE)); EXCEPTION_DICTIONARY.put("IllegalArgumentException", getBadRequestResult(ResultStatus.WARNING)); - - - EXCEPTION_DICTIONARY.put("MethodArgumentNotValidException", getResult(ResultStatus.WARNING)); } @@ -150,6 +151,10 @@ private static Result getUnauthorizedResult(ResultStatus resultCode) { return getResult(resultCode, HttpStatus.SC_UNAUTHORIZED); } + private static Result getValidationResult(ResultStatus resultCode) { + return getResult(resultCode, HttpStatus.SC_NOT_ACCEPTABLE); + } + private static Result getResult(ResultStatus resultCode) { return getResult(resultCode, HttpStatus.SC_INTERNAL_SERVER_ERROR); } @@ -174,8 +179,8 @@ public static Result resolveException(Exception ex, String path) { } result.path(path); - result.error(ex); - result.data(ex.getMessage()); + result.stackTrace(new StackTraceElement[]{}); + result.detail(ex.getMessage()); log.debug("[Eurynome] |- Global Exception Handler, Error is : {}", result); diff --git a/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/exception/IllegalArgumentException.java b/packages/eurynome-cloud-assistant/src/main/java/cn/herodotus/eurynome/assistant/exception/platform/IllegalArgumentException.java similarity index 87% rename from packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/exception/IllegalArgumentException.java rename to packages/eurynome-cloud-assistant/src/main/java/cn/herodotus/eurynome/assistant/exception/platform/IllegalArgumentException.java index 1d8d3739f..fccfaf00c 100644 --- a/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/exception/IllegalArgumentException.java +++ b/packages/eurynome-cloud-assistant/src/main/java/cn/herodotus/eurynome/assistant/exception/platform/IllegalArgumentException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2021 Gengwei Zheng(herodotus@aliyun.com) + * Copyright (c) 2019-2021 Gengwei Zheng (herodotus@aliyun.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,13 +14,13 @@ * limitations under the License. * * Project Name: eurynome-cloud - * Module Name: eurynome-cloud-common + * Module Name: eurynome-cloud-assistant * File Name: IllegalArgumentException.java * Author: gengwei.zheng - * Date: 2021/05/07 11:28:07 + * Date: 2021/08/18 17:52:18 */ -package cn.herodotus.eurynome.common.exception; +package cn.herodotus.eurynome.assistant.exception.platform; /** *

Description : 非法参数错误

diff --git a/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/exception/PlatformException.java b/packages/eurynome-cloud-assistant/src/main/java/cn/herodotus/eurynome/assistant/exception/platform/PlatformException.java similarity index 85% rename from packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/exception/PlatformException.java rename to packages/eurynome-cloud-assistant/src/main/java/cn/herodotus/eurynome/assistant/exception/platform/PlatformException.java index fed9cf7cd..aeadc5a52 100644 --- a/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/exception/PlatformException.java +++ b/packages/eurynome-cloud-assistant/src/main/java/cn/herodotus/eurynome/assistant/exception/platform/PlatformException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2021 Gengwei Zheng(herodotus@aliyun.com) + * Copyright (c) 2019-2021 Gengwei Zheng (herodotus@aliyun.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,15 +14,15 @@ * limitations under the License. * * Project Name: eurynome-cloud - * Module Name: eurynome-cloud-common + * Module Name: eurynome-cloud-assistant * File Name: PlatformException.java * Author: gengwei.zheng - * Date: 2021/05/07 11:28:07 + * Date: 2021/08/18 17:52:18 */ -package cn.herodotus.eurynome.common.exception; +package cn.herodotus.eurynome.assistant.exception.platform; -import cn.herodotus.eurynome.constant.enums.ResultStatus; +import cn.herodotus.eurynome.common.constant.enums.ResultStatus; /** *

Description: 平台基础Exception

diff --git a/packages/eurynome-cloud-assistant/src/main/java/cn/herodotus/eurynome/assistant/utils/PropertyResolver.java b/packages/eurynome-cloud-assistant/src/main/java/cn/herodotus/eurynome/assistant/utils/PropertyResolver.java index aa36caf37..299bad7ff 100644 --- a/packages/eurynome-cloud-assistant/src/main/java/cn/herodotus/eurynome/assistant/utils/PropertyResolver.java +++ b/packages/eurynome-cloud-assistant/src/main/java/cn/herodotus/eurynome/assistant/utils/PropertyResolver.java @@ -22,8 +22,8 @@ package cn.herodotus.eurynome.assistant.utils; -import cn.herodotus.eurynome.constant.magic.PlatformConstants; -import cn.herodotus.eurynome.constant.magic.PropertyConstants; +import cn.herodotus.eurynome.common.constant.magic.PlatformConstants; +import cn.herodotus.eurynome.common.constant.magic.PropertyConstants; import org.springframework.core.env.Environment; /** diff --git a/packages/eurynome-cloud-common/pom.xml b/packages/eurynome-cloud-common/pom.xml index e5fbb222f..b41efb368 100644 --- a/packages/eurynome-cloud-common/pom.xml +++ b/packages/eurynome-cloud-common/pom.xml @@ -29,20 +29,16 @@ packages cn.herodotus.eurynome - 2.5.4.50 + 2.5.4.55 eurynome-cloud-common - 2.5.4.50 + 2.5.4.55 jar 结对基础通用的工具类包,此包的定位是放在任何工程中都可以使用,而且尽可能依赖少的存在上下文组件 - - ${project.groupId} - eurynome-cloud-constant - commons-beanutils commons-beanutils @@ -85,7 +81,43 @@ guava + + com.fasterxml.jackson.dataformat + jackson-dataformat-yaml + + + + io.springfox + springfox-swagger2 + + + io.swagger + swagger-annotations + + + io.swagger + swagger-models + + + + + io.swagger + swagger-annotations + + + io.swagger + swagger-models + + + + com.github.whvcse + easy-captcha + + + me.zhyd.oauth + JustAuth + \ No newline at end of file diff --git a/packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/enums/AccountType.java b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/enums/AccountType.java similarity index 99% rename from packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/enums/AccountType.java rename to packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/enums/AccountType.java index e2e6fc46d..3d81a7fe2 100644 --- a/packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/enums/AccountType.java +++ b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/enums/AccountType.java @@ -20,7 +20,7 @@ * Date: 2021/08/05 18:32:05 */ -package cn.herodotus.eurynome.constant.enums; +package cn.herodotus.eurynome.common.constant.enums; /** *

Description: TODO

diff --git a/packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/enums/ApplicationType.java b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/enums/ApplicationType.java similarity index 98% rename from packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/enums/ApplicationType.java rename to packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/enums/ApplicationType.java index f0bf381a7..2323ea679 100644 --- a/packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/enums/ApplicationType.java +++ b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/enums/ApplicationType.java @@ -20,7 +20,7 @@ * Date: 2021/06/29 15:58:29 */ -package cn.herodotus.eurynome.constant.enums; +package cn.herodotus.eurynome.common.constant.enums; import com.fasterxml.jackson.annotation.JsonValue; import com.google.common.collect.ImmutableMap; diff --git a/packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/enums/Architecture.java b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/enums/Architecture.java similarity index 95% rename from packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/enums/Architecture.java rename to packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/enums/Architecture.java index 5c02c688c..6bdb848f3 100644 --- a/packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/enums/Architecture.java +++ b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/enums/Architecture.java @@ -20,7 +20,7 @@ * Date: 2021/06/29 15:58:29 */ -package cn.herodotus.eurynome.constant.enums; +package cn.herodotus.eurynome.common.constant.enums; /** *

Description : 用于区分是单体应用还是微服务应用

diff --git a/packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/enums/AuthorityType.java b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/enums/AuthorityType.java similarity index 98% rename from packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/enums/AuthorityType.java rename to packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/enums/AuthorityType.java index 0e6da484b..43e0f0c42 100644 --- a/packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/enums/AuthorityType.java +++ b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/enums/AuthorityType.java @@ -20,7 +20,7 @@ * Date: 2021/06/29 15:58:29 */ -package cn.herodotus.eurynome.constant.enums; +package cn.herodotus.eurynome.common.constant.enums; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonValue; diff --git a/packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/enums/DataAccessStrategy.java b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/enums/DataAccessStrategy.java similarity index 95% rename from packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/enums/DataAccessStrategy.java rename to packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/enums/DataAccessStrategy.java index dc6ad63f6..c3c426a62 100644 --- a/packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/enums/DataAccessStrategy.java +++ b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/enums/DataAccessStrategy.java @@ -20,7 +20,7 @@ * Date: 2021/07/28 19:07:28 */ -package cn.herodotus.eurynome.constant.enums; +package cn.herodotus.eurynome.common.constant.enums; /** *

Description: 数据访问策略枚举类型

diff --git a/packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/enums/GrantType.java b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/enums/GrantType.java similarity index 95% rename from packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/enums/GrantType.java rename to packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/enums/GrantType.java index d57255a51..e4adb953a 100644 --- a/packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/enums/GrantType.java +++ b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/enums/GrantType.java @@ -20,9 +20,9 @@ * Date: 2021/08/07 20:07:07 */ -package cn.herodotus.eurynome.constant.enums; +package cn.herodotus.eurynome.common.constant.enums; -import cn.herodotus.eurynome.constant.magic.SecurityConstants; +import cn.herodotus.eurynome.common.constant.magic.SecurityConstants; import com.google.common.collect.ImmutableMap; import java.util.ArrayList; diff --git a/packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/enums/OAuth2Expression.java b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/enums/OAuth2Expression.java similarity index 98% rename from packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/enums/OAuth2Expression.java rename to packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/enums/OAuth2Expression.java index 60bf0e51f..fcf8374a7 100644 --- a/packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/enums/OAuth2Expression.java +++ b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/enums/OAuth2Expression.java @@ -20,7 +20,7 @@ * Date: 2021/08/14 06:50:14 */ -package cn.herodotus.eurynome.constant.enums; +package cn.herodotus.eurynome.common.constant.enums; import com.google.common.collect.ImmutableMap; import io.swagger.annotations.ApiModelProperty; diff --git a/packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/enums/ProtocolType.java b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/enums/ProtocolType.java similarity index 96% rename from packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/enums/ProtocolType.java rename to packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/enums/ProtocolType.java index bb4a84d59..ebed80be0 100644 --- a/packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/enums/ProtocolType.java +++ b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/enums/ProtocolType.java @@ -20,7 +20,7 @@ * Date: 2021/06/29 15:58:29 */ -package cn.herodotus.eurynome.constant.enums; +package cn.herodotus.eurynome.common.constant.enums; /** *

Description: Protocol枚举

diff --git a/packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/enums/ResultStatus.java b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/enums/ResultStatus.java similarity index 98% rename from packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/enums/ResultStatus.java rename to packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/enums/ResultStatus.java index 0865f695b..2ec3fa869 100644 --- a/packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/enums/ResultStatus.java +++ b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/enums/ResultStatus.java @@ -20,7 +20,7 @@ * Date: 2021/06/29 15:58:29 */ -package cn.herodotus.eurynome.constant.enums; +package cn.herodotus.eurynome.common.constant.enums; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -81,6 +81,7 @@ public enum ResultStatus { */ BAD_SQL_GRAMMAR(6000, "低级SQL语法错误,检查SQL能否正常运行或者字段名称是否正确"), DATA_INTEGRITY_VIOLATION(6200, "该数据正在被其它数据引用,请先删除引用关系,再进行数据删除操作"), + METHOD_ARGUMENT_NOT_VALID(6300, "接口参数校验错误"), /** * 7*.* 基础设施交互错误 diff --git a/packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/enums/StatusEnum.java b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/enums/StatusEnum.java similarity index 98% rename from packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/enums/StatusEnum.java rename to packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/enums/StatusEnum.java index 197e28dae..cad1acabd 100644 --- a/packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/enums/StatusEnum.java +++ b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/enums/StatusEnum.java @@ -20,7 +20,7 @@ * Date: 2021/06/29 15:58:29 */ -package cn.herodotus.eurynome.constant.enums; +package cn.herodotus.eurynome.common.constant.enums; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonValue; diff --git a/packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/enums/captcha/CaptchaFont.java b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/enums/captcha/CaptchaFont.java similarity index 96% rename from packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/enums/captcha/CaptchaFont.java rename to packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/enums/captcha/CaptchaFont.java index c8ce3eae1..a4a517842 100644 --- a/packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/enums/captcha/CaptchaFont.java +++ b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/enums/captcha/CaptchaFont.java @@ -20,7 +20,7 @@ * Date: 2021/05/07 11:28:07 */ -package cn.herodotus.eurynome.constant.enums.captcha; +package cn.herodotus.eurynome.common.constant.enums.captcha; import com.wf.captcha.base.Captcha; diff --git a/packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/enums/captcha/CaptchaLetterType.java b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/enums/captcha/CaptchaLetterType.java similarity index 95% rename from packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/enums/captcha/CaptchaLetterType.java rename to packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/enums/captcha/CaptchaLetterType.java index 07eb749df..972f58256 100644 --- a/packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/enums/captcha/CaptchaLetterType.java +++ b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/enums/captcha/CaptchaLetterType.java @@ -20,7 +20,7 @@ * Date: 2021/05/07 11:28:07 */ -package cn.herodotus.eurynome.constant.enums.captcha; +package cn.herodotus.eurynome.common.constant.enums.captcha; import com.wf.captcha.base.Captcha; diff --git a/packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/enums/captcha/CaptchaType.java b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/enums/captcha/CaptchaType.java similarity index 94% rename from packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/enums/captcha/CaptchaType.java rename to packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/enums/captcha/CaptchaType.java index f0a596543..87dec38ab 100644 --- a/packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/enums/captcha/CaptchaType.java +++ b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/enums/captcha/CaptchaType.java @@ -20,7 +20,7 @@ * Date: 2021/05/07 11:28:07 */ -package cn.herodotus.eurynome.constant.enums.captcha; +package cn.herodotus.eurynome.common.constant.enums.captcha; /** *

Description : CaptchaType

diff --git a/packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/magic/CacheConstants.java b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/magic/CacheConstants.java similarity index 97% rename from packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/magic/CacheConstants.java rename to packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/magic/CacheConstants.java index f944a1329..33d3a31c4 100644 --- a/packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/magic/CacheConstants.java +++ b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/magic/CacheConstants.java @@ -20,7 +20,7 @@ * Date: 2021/08/07 20:09:07 */ -package cn.herodotus.eurynome.constant.magic; +package cn.herodotus.eurynome.common.constant.magic; /** *

Description: 缓存相关常量

diff --git a/packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/magic/PlatformConstants.java b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/magic/PlatformConstants.java similarity index 95% rename from packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/magic/PlatformConstants.java rename to packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/magic/PlatformConstants.java index 66842f986..89c006c5a 100644 --- a/packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/magic/PlatformConstants.java +++ b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/magic/PlatformConstants.java @@ -20,7 +20,7 @@ * Date: 2021/06/29 15:58:29 */ -package cn.herodotus.eurynome.constant.magic; +package cn.herodotus.eurynome.common.constant.magic; /** *

Description: 系统常量

diff --git a/packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/magic/PropertyConstants.java b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/magic/PropertyConstants.java similarity index 98% rename from packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/magic/PropertyConstants.java rename to packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/magic/PropertyConstants.java index 1d97b40e2..4ac68c001 100644 --- a/packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/magic/PropertyConstants.java +++ b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/magic/PropertyConstants.java @@ -20,7 +20,7 @@ * Date: 2021/08/07 20:09:07 */ -package cn.herodotus.eurynome.constant.magic; +package cn.herodotus.eurynome.common.constant.magic; /** *

Description: 平台涉及的各种Property值

diff --git a/packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/magic/SecurityConstants.java b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/magic/SecurityConstants.java similarity index 95% rename from packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/magic/SecurityConstants.java rename to packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/magic/SecurityConstants.java index b21d424cf..88541a82f 100644 --- a/packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/magic/SecurityConstants.java +++ b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/magic/SecurityConstants.java @@ -20,9 +20,7 @@ * Date: 2021/06/29 15:58:29 */ -package cn.herodotus.eurynome.constant.magic; - -import cn.herodotus.eurynome.constant.magic.SymbolConstants; +package cn.herodotus.eurynome.common.constant.magic; /** *

Description: 认证授权等安全相关常量值

diff --git a/packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/magic/SecurityExpression.java b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/magic/SecurityExpression.java similarity index 95% rename from packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/magic/SecurityExpression.java rename to packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/magic/SecurityExpression.java index 3fe1931ef..17d0822c2 100644 --- a/packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/magic/SecurityExpression.java +++ b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/magic/SecurityExpression.java @@ -20,7 +20,7 @@ * Date: 2021/08/05 18:32:05 */ -package cn.herodotus.eurynome.constant.magic; +package cn.herodotus.eurynome.common.constant.magic; /** *

Description: 静态权限表达式

diff --git a/packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/magic/ServiceConstants.java b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/magic/ServiceConstants.java similarity index 95% rename from packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/magic/ServiceConstants.java rename to packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/magic/ServiceConstants.java index a317cb70c..fbbebf028 100644 --- a/packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/magic/ServiceConstants.java +++ b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/magic/ServiceConstants.java @@ -20,7 +20,7 @@ * Date: 2021/08/07 20:06:07 */ -package cn.herodotus.eurynome.constant.magic; +package cn.herodotus.eurynome.common.constant.magic; /** *

Description: 服务相关常量

diff --git a/packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/magic/SymbolConstants.java b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/magic/SymbolConstants.java similarity index 98% rename from packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/magic/SymbolConstants.java rename to packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/magic/SymbolConstants.java index 91593379f..b35b012db 100644 --- a/packages/eurynome-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/magic/SymbolConstants.java +++ b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/constant/magic/SymbolConstants.java @@ -20,7 +20,7 @@ * Date: 2021/06/29 15:58:29 */ -package cn.herodotus.eurynome.constant.magic; +package cn.herodotus.eurynome.common.constant.magic; /** * @author gengwei.zheng diff --git a/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/domain/Error.java b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/domain/Error.java new file mode 100644 index 000000000..79e4a34de --- /dev/null +++ b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/domain/Error.java @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2019-2021 Gengwei Zheng (herodotus@aliyun.com) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Project Name: eurynome-cloud + * Module Name: eurynome-cloud-common + * File Name: Error.java + * Author: gengwei.zheng + * Date: 2021/08/18 18:12:18 + */ + +package cn.herodotus.eurynome.common.domain; + +import com.google.common.base.MoreObjects; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import java.io.Serializable; + +/** + *

Description: 错误详情

+ * + * @author : gengwei.zheng + * @date : 2021/8/18 18:12 + */ +@ApiModel(description = "响应错误详情") +public class Error implements Serializable { + + @ApiModelProperty(value = "Exception完整信息") + private String detail; + + @ApiModelProperty(value = "额外的错误信息,目前主要是Validation的Message") + private String message; + + @ApiModelProperty(value = "额外的错误代码,目前主要是Validation的Code") + private String code; + + @ApiModelProperty(value = "额外的错误字段,目前主要是Validation的Field") + private String field; + + public String getDetail() { + return detail; + } + + public void setDetail(String detail) { + this.detail = detail; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getField() { + return field; + } + + public void setField(String field) { + this.field = field; + } + + @Override + public String toString() { + return MoreObjects.toStringHelper(this) + .add("detail", detail) + .add("message", message) + .add("code", code) + .add("field", field) + .toString(); + } +} diff --git a/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/domain/Result.java b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/domain/Result.java index 55d140068..eac2e31f9 100644 --- a/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/domain/Result.java +++ b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/domain/Result.java @@ -23,7 +23,7 @@ package cn.herodotus.eurynome.common.domain; -import cn.herodotus.eurynome.constant.enums.ResultStatus; +import cn.herodotus.eurynome.common.constant.enums.ResultStatus; import com.fasterxml.jackson.annotation.JsonFormat; import com.google.common.base.MoreObjects; import io.swagger.annotations.ApiModel; @@ -60,12 +60,15 @@ public class Result implements Serializable { private int status; @ApiModelProperty(value = "错误堆栈信息") - private Throwable error; + private StackTraceElement[] stackTrace; @ApiModelProperty(value = "响应时间戳") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date timestamp = new Date(); + @ApiModelProperty(value = "校验错误信息") + private Error error = new Error(); + public Result() { super(); } @@ -90,12 +93,16 @@ public int getStatus() { return status; } + public StackTraceElement[] getStackTrace() { + return stackTrace; + } + public Date getTimestamp() { return timestamp; } - public void setTimestamp(Date timestamp) { - this.timestamp = timestamp; + public Error getError() { + return error; } public Result ok() { @@ -143,8 +150,20 @@ public Result status(int httpStatus) { return this; } - public Result error(Throwable error) { - this.error = error; + public Result stackTrace(StackTraceElement[] stackTrace) { + this.stackTrace = stackTrace; + return this; + } + + public Result detail(String detail) { + this.error.setDetail(detail); + return this; + } + + public Result validation(String message, String code, String field) { + this.error.setMessage(message); + this.error.setCode(code); + this.error.setField(field); return this; } @@ -156,8 +175,9 @@ public String toString() { .add("path", path) .add("data", data) .add("status", status) - .add("error", error) + .add("stackTrace", stackTrace) .add("timestamp", timestamp) + .add("error", error) .toString(); } @@ -168,8 +188,9 @@ public Map toModel() { result.put("path", path); result.put("data", data); result.put("status", status); - result.put("error", error); + result.put("stackTrace", stackTrace); result.put("timestamp", timestamp); + result.put("error", error); return result; } } diff --git a/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/domain/TreeNode.java b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/domain/TreeNode.java deleted file mode 100644 index a8c6cb11c..000000000 --- a/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/domain/TreeNode.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2019-2021 Gengwei Zheng(herodotus@aliyun.com) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Project Name: eurynome-cloud - * Module Name: eurynome-cloud-common - * File Name: TreeNode.java - * Author: gengwei.zheng - * Date: 2021/05/07 11:28:07 - */ - -package cn.herodotus.eurynome.common.domain; - -import org.apache.commons.lang3.builder.ToStringBuilder; - -import java.io.Serializable; -import java.util.List; - -/** - * 属性结构定义 - * - * @author gengwei.zheng - */ -public class TreeNode implements Serializable { - - /** - * 本节点id - */ - private String id; - /** - * 本节点名称 - */ - private String name; - - /** - * 本节点的父节点 - */ - private String parentId; - private List children; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getParentId() { - return parentId; - } - - public void setParentId(String parentId) { - this.parentId = parentId; - } - - public List getChildren() { - return children; - } - - public void setChildren(List children) { - this.children = children; - } - - @Override - public String toString() { - return new ToStringBuilder(this) - .append("id", id) - .append("name", name) - .append("parentId", parentId) - .append("children", children) - .toString(); - } -} diff --git a/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/jackson/deserializer/StatusEnumDeserializer.java b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/jackson/deserializer/StatusEnumDeserializer.java index 07a89d012..e1c40c4d6 100644 --- a/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/jackson/deserializer/StatusEnumDeserializer.java +++ b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/jackson/deserializer/StatusEnumDeserializer.java @@ -22,7 +22,7 @@ package cn.herodotus.eurynome.common.jackson.deserializer; -import cn.herodotus.eurynome.constant.enums.StatusEnum; +import cn.herodotus.eurynome.common.constant.enums.StatusEnum; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.DeserializationContext; diff --git a/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/utils/ConvertUtils.java b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/utils/ConvertUtils.java index ed04815a3..a8c77e6cd 100644 --- a/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/utils/ConvertUtils.java +++ b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/utils/ConvertUtils.java @@ -22,8 +22,8 @@ package cn.herodotus.eurynome.common.utils; -import cn.herodotus.eurynome.constant.magic.SymbolConstants; -import cn.herodotus.eurynome.constant.enums.ProtocolType; +import cn.herodotus.eurynome.common.constant.magic.SymbolConstants; +import cn.herodotus.eurynome.common.constant.enums.ProtocolType; import org.apache.commons.lang3.StringUtils; /** diff --git a/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/utils/JacksonYamlUtils.java b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/utils/JacksonYamlUtils.java index 03c07d405..3e97f95d3 100644 --- a/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/utils/JacksonYamlUtils.java +++ b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/utils/JacksonYamlUtils.java @@ -22,7 +22,7 @@ package cn.herodotus.eurynome.common.utils; -import cn.herodotus.eurynome.constant.magic.SymbolConstants; +import cn.herodotus.eurynome.common.constant.magic.SymbolConstants; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/utils/OkHttpUtils.java b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/utils/OkHttpUtils.java deleted file mode 100644 index 735fd7343..000000000 --- a/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/utils/OkHttpUtils.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (c) 2019-2021 Gengwei Zheng(herodotus@aliyun.com) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Project Name: eurynome-cloud - * Module Name: eurynome-cloud-common - * File Name: OkHttpUtils.java - * Author: gengwei.zheng - * Date: 2021/05/07 11:28:07 - */ - -package cn.herodotus.eurynome.common.utils; - -import com.alibaba.fastjson.JSON; -import lombok.extern.slf4j.Slf4j; -import okhttp3.*; -import org.apache.commons.collections.MapUtils; -import org.apache.commons.lang3.StringUtils; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -/** - *

Description: OkHttpUtils

- * - * @author : gengwei.zheng - * @date : 2020/2/29 17:06 - */ -@Slf4j -public class OkHttpUtils { - - public static final String AMPERSAND = "&"; - public static final String EQUAL = "="; - public static final String QUESTION = "?"; - - /** - * 懒汉 安全 加同步 - * 私有的静态成员变量 只声明不创建 - * 私有的构造方法 - * 提供返回实例的静态方法 - */ - private static OkHttpClient okHttpClient = null; - - - private OkHttpUtils() { - } - - public static OkHttpClient getInstance() { - if (okHttpClient == null) { - //加同步安全 - synchronized (OkHttpUtils.class) { - if (okHttpClient == null) { - okHttpClient = new OkHttpClient.Builder() - .connectTimeout(15, TimeUnit.SECONDS) - .writeTimeout(20, TimeUnit.SECONDS) - .readTimeout(20, TimeUnit.SECONDS) - .build(); - } - } - - } - - return okHttpClient; - } - - private static String addParamsToGetReqeust(String url, Map params) { - StringBuilder sb = new StringBuilder(url); - if (MapUtils.isNotEmpty(params)) { - sb.append(QUESTION); - - for (Map.Entry entry : params.entrySet()) { - String key = entry.getKey(); - String value = entry.getValue(); - sb.append(key); - sb.append(EQUAL); - sb.append(value); - sb.append(AMPERSAND); - } - - return StringUtils.removeEnd(sb.toString(), AMPERSAND); - } - - return url; - } - - public static String get(String url, Map params){ - return get(url, new HashMap<>(8), params); - } - - /** - * Get请求 - * - * @param url URL地址 - * @return 返回结果 - */ - public static String get(String url, Map headers, Map params){ - - String urlWithParams = addParamsToGetReqeust(url, params); - - Request.Builder requestBuilder = new Request.Builder(); - if(MapUtils.isNotEmpty(headers)) { - for (String key : headers.keySet()) { - requestBuilder.addHeader(key, headers.get(key)); - } - } - - Request request = requestBuilder.url(urlWithParams).build(); - - try { - Response response = getInstance().newCall(request).execute(); - String result = response.body().toString(); - log.debug("[OkHttp] |- OkHttp Get Request returned value is : [{}]", result); - return result; - } catch (IOException e) { - log.error("[OkHttp] |- OkHttp Post Request Catch the Error!", e); - return null; - } - } - - /** - * Post请求 - * - * @param url URL地址 - * @param params 参数 - * @return 返回结果 - */ - public static String post(String url, Map params) { - if (MapUtils.isEmpty(params)) { - params = new HashMap<>(8); - } - - FormBody.Builder formBodyBuilder = new FormBody.Builder(); - for (Map.Entry map : params.entrySet()) { - String key = map.getKey(); - String value; - if (map.getValue() == null) { - value = ""; - } else { - value = map.getValue(); - } - formBodyBuilder.add(key, value); - } - FormBody formBody = formBodyBuilder.build(); - log.debug("[OkHttp] |- OkHttp Post Request add params : [{}]", JSON.toJSONString(params)); - - try { - Request request = new Request.Builder().url(url).post(formBody).build(); - Response response = getInstance().newCall(request).execute(); - String result = response.body().string(); - log.debug("[OkHttp] |- OkHttp Post Request returned value is : [{}]", result); - return result; - } catch (Exception e) { - log.error("[OkHttp] |- OkHttp Post Request Catch the Error!", e); - return null; - } - } -} diff --git a/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/utils/TreeUtils.java b/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/utils/TreeUtils.java deleted file mode 100644 index 20e473cea..000000000 --- a/packages/eurynome-cloud-common/src/main/java/cn/herodotus/eurynome/common/utils/TreeUtils.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2019-2021 Gengwei Zheng(herodotus@aliyun.com) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Project Name: eurynome-cloud - * Module Name: eurynome-cloud-common - * File Name: TreeUtils.java - * Author: gengwei.zheng - * Date: 2021/05/07 11:28:07 - */ - -package cn.herodotus.eurynome.common.utils; - -import cn.herodotus.eurynome.common.domain.TreeNode; -import org.apache.commons.lang3.StringUtils; - -import java.util.ArrayList; -import java.util.List; - -/** - * 树形对象构造工具类 - * - * @author gengwei.zheng - */ -public class TreeUtils { - - public final static String DEFAULT_ROOT_ID = "0"; - - public static List build(List treeNodes) { - return build(treeNodes, DEFAULT_ROOT_ID); - } - - /** - * 使用递归方法建树 - * @param treeNodes - * @return - */ - public static List build(List treeNodes, String root) { - if (StringUtils.isEmpty(root)) { - root = DEFAULT_ROOT_ID; - } - - List trees = new ArrayList<>(); - for (N treeNode : treeNodes) { - if (root.equals(treeNode.getParentId())) { - trees.add(findChildren(treeNode,treeNodes)); - } - } - return trees; - } - - /** - * 递归查找子节点 - * @param treeNodes - * @return - */ - public static N findChildren(N parentTreeNode,List treeNodes) { - for (N treeNode : treeNodes) { - if(parentTreeNode.getId().equals(treeNode.getParentId())) { - if (parentTreeNode.getChildren() == null) { - parentTreeNode.setChildren(new ArrayList<>()); - } - parentTreeNode.getChildren().add(findChildren(treeNode,treeNodes)); - } - } - return parentTreeNode; - } -} diff --git a/packages/eurynome-cloud-constant/pom.xml b/packages/eurynome-cloud-constant/pom.xml deleted file mode 100644 index fabacfe0b..000000000 --- a/packages/eurynome-cloud-constant/pom.xml +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - packages - cn.herodotus.eurynome - 2.5.4.50 - - 4.0.0 - - eurynome-cloud-constant - - - - com.fasterxml.jackson.dataformat - jackson-dataformat-yaml - - - - io.springfox - springfox-swagger2 - - - io.swagger - swagger-annotations - - - io.swagger - swagger-models - - - - - io.swagger - swagger-annotations - - - io.swagger - swagger-models - - - - com.github.whvcse - easy-captcha - - - - me.zhyd.oauth - JustAuth - - - - \ No newline at end of file diff --git a/packages/eurynome-cloud-crud/pom.xml b/packages/eurynome-cloud-crud/pom.xml index 01300c40f..79d1691b7 100644 --- a/packages/eurynome-cloud-crud/pom.xml +++ b/packages/eurynome-cloud-crud/pom.xml @@ -29,11 +29,11 @@ packages cn.herodotus.eurynome - 2.5.4.50 + 2.5.4.55 eurynome-cloud-crud - 2.5.4.50 + 2.5.4.55 jar diff --git a/packages/eurynome-cloud-crud/src/main/java/cn/herodotus/eurynome/crud/controller/BaseReadableRestController.java b/packages/eurynome-cloud-crud/src/main/java/cn/herodotus/eurynome/crud/controller/BaseReadableRestController.java index 10eacef0c..97aa6cc99 100644 --- a/packages/eurynome-cloud-crud/src/main/java/cn/herodotus/eurynome/crud/controller/BaseReadableRestController.java +++ b/packages/eurynome-cloud-crud/src/main/java/cn/herodotus/eurynome/crud/controller/BaseReadableRestController.java @@ -24,11 +24,11 @@ import cn.herodotus.eurynome.common.definition.entity.AbstractEntity; import cn.herodotus.eurynome.common.domain.Result; +import cn.herodotus.eurynome.rest.base.business.Pager; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestParam; import java.io.Serializable; import java.util.Map; @@ -43,14 +43,10 @@ public abstract class BaseReadableRestController> findByPage( - @RequestParam("pageNumber") Integer pageNumber, - @RequestParam("pageSize") Integer pageSize) { - return ReadableController.super.findByPage(pageNumber, pageSize); + public Result> findByPage(Pager pager) { + return ReadableController.super.findByPage(pager.getPageNumber(), pager.getPageSize()); } } diff --git a/packages/eurynome-cloud-crud/src/main/java/cn/herodotus/eurynome/crud/service/AbstractCacheService.java b/packages/eurynome-cloud-crud/src/main/java/cn/herodotus/eurynome/crud/service/AbstractCacheService.java index fb8d84436..e9d7a3c0f 100644 --- a/packages/eurynome-cloud-crud/src/main/java/cn/herodotus/eurynome/crud/service/AbstractCacheService.java +++ b/packages/eurynome-cloud-crud/src/main/java/cn/herodotus/eurynome/crud/service/AbstractCacheService.java @@ -22,7 +22,7 @@ package cn.herodotus.eurynome.crud.service; -import cn.herodotus.eurynome.constant.magic.SymbolConstants; +import cn.herodotus.eurynome.common.constant.magic.SymbolConstants; import cn.herodotus.eurynome.common.definition.entity.AbstractEntity; import cn.herodotus.eurynome.common.definition.entity.Entity; import cn.herodotus.eurynome.data.cache.query.AbstractCache; diff --git a/packages/eurynome-cloud-data/pom.xml b/packages/eurynome-cloud-data/pom.xml index 56227187d..31b41e920 100644 --- a/packages/eurynome-cloud-data/pom.xml +++ b/packages/eurynome-cloud-data/pom.xml @@ -29,11 +29,11 @@ packages cn.herodotus.eurynome - 2.5.4.50 + 2.5.4.55 eurynome-cloud-data - 2.5.4.50 + 2.5.4.55 jar 数据相关通用代码组件包,包括JPA,Redis,数据实体等相关内容 diff --git a/packages/eurynome-cloud-data/src/main/java/cn/herodotus/eurynome/data/base/entity/BaseAppEntity.java b/packages/eurynome-cloud-data/src/main/java/cn/herodotus/eurynome/data/base/entity/BaseAppEntity.java index 8cec1f9b6..2d9e626b7 100644 --- a/packages/eurynome-cloud-data/src/main/java/cn/herodotus/eurynome/data/base/entity/BaseAppEntity.java +++ b/packages/eurynome-cloud-data/src/main/java/cn/herodotus/eurynome/data/base/entity/BaseAppEntity.java @@ -22,7 +22,7 @@ package cn.herodotus.eurynome.data.base.entity; -import cn.herodotus.eurynome.constant.enums.ApplicationType; +import cn.herodotus.eurynome.common.constant.enums.ApplicationType; import cn.hutool.core.util.IdUtil; import javax.persistence.Column; diff --git a/packages/eurynome-cloud-data/src/main/java/cn/herodotus/eurynome/data/base/entity/BaseSysEntity.java b/packages/eurynome-cloud-data/src/main/java/cn/herodotus/eurynome/data/base/entity/BaseSysEntity.java index b10d64836..ed574a0e3 100644 --- a/packages/eurynome-cloud-data/src/main/java/cn/herodotus/eurynome/data/base/entity/BaseSysEntity.java +++ b/packages/eurynome-cloud-data/src/main/java/cn/herodotus/eurynome/data/base/entity/BaseSysEntity.java @@ -22,7 +22,7 @@ package cn.herodotus.eurynome.data.base.entity; -import cn.herodotus.eurynome.constant.enums.StatusEnum; +import cn.herodotus.eurynome.common.constant.enums.StatusEnum; import io.swagger.annotations.ApiModelProperty; import org.springframework.data.jpa.domain.support.AuditingEntityListener; diff --git a/packages/eurynome-cloud-data/src/main/java/cn/herodotus/eurynome/data/cache/query/AbstractCache.java b/packages/eurynome-cloud-data/src/main/java/cn/herodotus/eurynome/data/cache/query/AbstractCache.java index bdc4e8893..b90030db8 100644 --- a/packages/eurynome-cloud-data/src/main/java/cn/herodotus/eurynome/data/cache/query/AbstractCache.java +++ b/packages/eurynome-cloud-data/src/main/java/cn/herodotus/eurynome/data/cache/query/AbstractCache.java @@ -22,8 +22,8 @@ package cn.herodotus.eurynome.data.cache.query; -import cn.herodotus.eurynome.constant.magic.CacheConstants; -import cn.herodotus.eurynome.constant.magic.SymbolConstants; +import cn.herodotus.eurynome.common.constant.magic.CacheConstants; +import cn.herodotus.eurynome.common.constant.magic.SymbolConstants; import cn.herodotus.eurynome.common.definition.entity.AbstractEntity; import com.alicp.jetcache.Cache; import lombok.extern.slf4j.Slf4j; diff --git a/packages/eurynome-cloud-data/src/main/java/cn/herodotus/eurynome/data/properties/CacheProperties.java b/packages/eurynome-cloud-data/src/main/java/cn/herodotus/eurynome/data/properties/CacheProperties.java index d9b77cde8..8ce842a24 100644 --- a/packages/eurynome-cloud-data/src/main/java/cn/herodotus/eurynome/data/properties/CacheProperties.java +++ b/packages/eurynome-cloud-data/src/main/java/cn/herodotus/eurynome/data/properties/CacheProperties.java @@ -22,7 +22,7 @@ package cn.herodotus.eurynome.data.properties; -import cn.herodotus.eurynome.constant.magic.PropertyConstants; +import cn.herodotus.eurynome.common.constant.magic.PropertyConstants; import com.google.common.base.MoreObjects; import org.apache.commons.lang3.ObjectUtils; import org.springframework.boot.context.properties.ConfigurationProperties; diff --git a/packages/eurynome-cloud-data/src/main/java/cn/herodotus/eurynome/data/properties/QueueProperties.java b/packages/eurynome-cloud-data/src/main/java/cn/herodotus/eurynome/data/properties/QueueProperties.java index 2278a0871..3857ef93d 100644 --- a/packages/eurynome-cloud-data/src/main/java/cn/herodotus/eurynome/data/properties/QueueProperties.java +++ b/packages/eurynome-cloud-data/src/main/java/cn/herodotus/eurynome/data/properties/QueueProperties.java @@ -22,7 +22,7 @@ package cn.herodotus.eurynome.data.properties; -import cn.herodotus.eurynome.constant.magic.PropertyConstants; +import cn.herodotus.eurynome.common.constant.magic.PropertyConstants; import org.springframework.boot.context.properties.ConfigurationProperties; /** diff --git a/packages/eurynome-cloud-kernel/pom.xml b/packages/eurynome-cloud-kernel/pom.xml index 692f3d0f4..33fa357cc 100644 --- a/packages/eurynome-cloud-kernel/pom.xml +++ b/packages/eurynome-cloud-kernel/pom.xml @@ -29,11 +29,11 @@ packages cn.herodotus.eurynome - 2.5.4.50 + 2.5.4.55 eurynome-cloud-kernel - 2.5.4.50 + 2.5.4.55 jar 平台通用的基础依赖,以及接入及管理等通用代码,上中台必需的基础代码。增加这层包,主要目的是抽取webflux和web依赖的通用性,降低其它包之间的耦合性,比如之前data要依赖logstash,logstash要依赖managementproperties diff --git a/packages/eurynome-cloud-kernel/src/main/java/cn/herodotus/eurynome/kernel/properties/ManagementProperties.java b/packages/eurynome-cloud-kernel/src/main/java/cn/herodotus/eurynome/kernel/properties/ManagementProperties.java index d2e378cd0..089f0b54b 100644 --- a/packages/eurynome-cloud-kernel/src/main/java/cn/herodotus/eurynome/kernel/properties/ManagementProperties.java +++ b/packages/eurynome-cloud-kernel/src/main/java/cn/herodotus/eurynome/kernel/properties/ManagementProperties.java @@ -22,7 +22,7 @@ package cn.herodotus.eurynome.kernel.properties; -import cn.herodotus.eurynome.constant.magic.PropertyConstants; +import cn.herodotus.eurynome.common.constant.magic.PropertyConstants; import lombok.extern.slf4j.Slf4j; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.logging.LogLevel; diff --git a/packages/eurynome-cloud-oauth-starter/pom.xml b/packages/eurynome-cloud-oauth-starter/pom.xml index c686a2691..6edebdf05 100644 --- a/packages/eurynome-cloud-oauth-starter/pom.xml +++ b/packages/eurynome-cloud-oauth-starter/pom.xml @@ -30,11 +30,11 @@ packages cn.herodotus.eurynome - 2.5.4.50 + 2.5.4.55 eurynome-cloud-oauth-starter - 2.5.4.50 + 2.5.4.55 jar diff --git a/packages/eurynome-cloud-oauth-starter/src/main/java/cn/herodotus/eurynome/oauth/autoconfigure/service/HerodotusOauthClientDetailsService.java b/packages/eurynome-cloud-oauth-starter/src/main/java/cn/herodotus/eurynome/oauth/autoconfigure/service/HerodotusOauthClientDetailsService.java index e7fe38964..a60f60aa5 100644 --- a/packages/eurynome-cloud-oauth-starter/src/main/java/cn/herodotus/eurynome/oauth/autoconfigure/service/HerodotusOauthClientDetailsService.java +++ b/packages/eurynome-cloud-oauth-starter/src/main/java/cn/herodotus/eurynome/oauth/autoconfigure/service/HerodotusOauthClientDetailsService.java @@ -22,7 +22,7 @@ package cn.herodotus.eurynome.oauth.autoconfigure.service; -import cn.herodotus.eurynome.constant.enums.StatusEnum; +import cn.herodotus.eurynome.common.constant.enums.StatusEnum; import cn.herodotus.eurynome.security.definition.core.HerodotusClientDetails; import cn.herodotus.eurynome.security.definition.service.HerodotusClientDetailsService; import cn.herodotus.eurynome.upms.api.entity.oauth.OauthClientDetails; diff --git a/packages/eurynome-cloud-oauth/pom.xml b/packages/eurynome-cloud-oauth/pom.xml index 8ea5ed0bb..2faa18a9c 100644 --- a/packages/eurynome-cloud-oauth/pom.xml +++ b/packages/eurynome-cloud-oauth/pom.xml @@ -29,12 +29,12 @@ packages cn.herodotus.eurynome - 2.5.4.50 + 2.5.4.55 eurynome-cloud-oauth - 2.5.4.50 + 2.5.4.55 jar diff --git a/packages/eurynome-cloud-oauth/src/main/java/cn/herodotus/eurynome/oauth/controller/VerificationCodeController.java b/packages/eurynome-cloud-oauth/src/main/java/cn/herodotus/eurynome/oauth/controller/VerificationCodeController.java index 4033369fb..2b3b8d423 100644 --- a/packages/eurynome-cloud-oauth/src/main/java/cn/herodotus/eurynome/oauth/controller/VerificationCodeController.java +++ b/packages/eurynome-cloud-oauth/src/main/java/cn/herodotus/eurynome/oauth/controller/VerificationCodeController.java @@ -22,7 +22,7 @@ package cn.herodotus.eurynome.oauth.controller; -import cn.herodotus.eurynome.constant.enums.captcha.CaptchaType; +import cn.herodotus.eurynome.common.constant.enums.captcha.CaptchaType; import cn.herodotus.eurynome.security.properties.SecurityProperties; import com.wf.captcha.*; import com.wf.captcha.base.Captcha; diff --git a/packages/eurynome-cloud-oauth/src/main/java/cn/herodotus/eurynome/oauth/utils/SymmetricUtils.java b/packages/eurynome-cloud-oauth/src/main/java/cn/herodotus/eurynome/oauth/utils/SymmetricUtils.java index c176c740a..c981b00bd 100644 --- a/packages/eurynome-cloud-oauth/src/main/java/cn/herodotus/eurynome/oauth/utils/SymmetricUtils.java +++ b/packages/eurynome-cloud-oauth/src/main/java/cn/herodotus/eurynome/oauth/utils/SymmetricUtils.java @@ -25,7 +25,7 @@ import cn.hutool.core.util.RandomUtil; import cn.hutool.crypto.SecureUtil; import cn.hutool.crypto.symmetric.AES; -import cn.herodotus.eurynome.constant.magic.SymbolConstants; +import cn.herodotus.eurynome.common.constant.magic.SymbolConstants; import cn.herodotus.eurynome.oauth.exception.IllegalSymmetricKeyException; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.ArrayUtils; diff --git a/packages/eurynome-cloud-oauth/src/main/resources/templates/error.html b/packages/eurynome-cloud-oauth/src/main/resources/templates/error.html index 5a30a13cd..69992ccb6 100644 --- a/packages/eurynome-cloud-oauth/src/main/resources/templates/error.html +++ b/packages/eurynome-cloud-oauth/src/main/resources/templates/error.html @@ -48,7 +48,7 @@

异常堆栈跟踪日志,StackTrace:

-
+
[[${line}]]
diff --git a/packages/eurynome-cloud-rest/pom.xml b/packages/eurynome-cloud-rest/pom.xml index 88b7b357e..fac4041e3 100644 --- a/packages/eurynome-cloud-rest/pom.xml +++ b/packages/eurynome-cloud-rest/pom.xml @@ -29,17 +29,17 @@ packages cn.herodotus.eurynome - 2.5.4.50 + 2.5.4.55 eurynome-cloud-rest - 2.5.4.50 + 2.5.4.55 jar ${project.groupId} - eurynome-cloud-common + eurynome-cloud-assistant diff --git a/packages/eurynome-cloud-rest/src/main/java/cn/herodotus/eurynome/rest/base/business/Pager.java b/packages/eurynome-cloud-rest/src/main/java/cn/herodotus/eurynome/rest/base/business/Pager.java new file mode 100644 index 000000000..60d441ac6 --- /dev/null +++ b/packages/eurynome-cloud-rest/src/main/java/cn/herodotus/eurynome/rest/base/business/Pager.java @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2019-2021 Gengwei Zheng (herodotus@aliyun.com) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Project Name: eurynome-cloud + * Module Name: eurynome-cloud-rest + * File Name: Pager.java + * Author: gengwei.zheng + * Date: 2021/08/18 17:55:18 + */ + +package cn.herodotus.eurynome.rest.base.business; + +import com.google.common.base.MoreObjects; + +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; + +/** + *

Description: 分页参数Bo对象

+ * + * @author : gengwei.zheng + * @date : 2021/8/18 17:55 + */ +public class Pager { + + @NotNull(message = "页码不能为空") + @Min(value = 0, message = "页码不能为负") + private Integer pageNumber; + + @NotNull(message = "每页条数不能为空") + @Min(value = 1, message = "每页条数至少为1条") + @Max(value = 1000, message = "每页条数不能超过1000") + private Integer pageSize; + + public Integer getPageNumber() { + return pageNumber; + } + + public void setPageNumber(Integer pageNumber) { + this.pageNumber = pageNumber; + } + + public Integer getPageSize() { + return pageSize; + } + + public void setPageSize(Integer pageSize) { + this.pageSize = pageSize; + } + + @Override + public String toString() { + return MoreObjects.toStringHelper(this) + .add("pageNumber", pageNumber) + .add("pageSize", pageSize) + .toString(); + } +} diff --git a/packages/eurynome-cloud-rest/src/main/java/cn/herodotus/eurynome/rest/configuration/SwaggerConfiguration.java b/packages/eurynome-cloud-rest/src/main/java/cn/herodotus/eurynome/rest/configuration/SwaggerConfiguration.java index b233737c2..2882ab0c3 100644 --- a/packages/eurynome-cloud-rest/src/main/java/cn/herodotus/eurynome/rest/configuration/SwaggerConfiguration.java +++ b/packages/eurynome-cloud-rest/src/main/java/cn/herodotus/eurynome/rest/configuration/SwaggerConfiguration.java @@ -22,8 +22,8 @@ package cn.herodotus.eurynome.rest.configuration; -import cn.herodotus.eurynome.constant.magic.SecurityConstants; -import cn.herodotus.eurynome.constant.enums.Architecture; +import cn.herodotus.eurynome.common.constant.magic.SecurityConstants; +import cn.herodotus.eurynome.common.constant.enums.Architecture; import cn.herodotus.eurynome.rest.properties.PlatformProperties; import cn.herodotus.eurynome.rest.properties.ServiceProperties; import io.swagger.annotations.Api; diff --git a/packages/eurynome-cloud-rest/src/main/java/cn/herodotus/eurynome/rest/properties/PlatformProperties.java b/packages/eurynome-cloud-rest/src/main/java/cn/herodotus/eurynome/rest/properties/PlatformProperties.java index d1a556182..816e2018f 100644 --- a/packages/eurynome-cloud-rest/src/main/java/cn/herodotus/eurynome/rest/properties/PlatformProperties.java +++ b/packages/eurynome-cloud-rest/src/main/java/cn/herodotus/eurynome/rest/properties/PlatformProperties.java @@ -22,12 +22,12 @@ package cn.herodotus.eurynome.rest.properties; -import cn.herodotus.eurynome.constant.enums.ProtocolType; -import cn.herodotus.eurynome.constant.magic.PropertyConstants; -import cn.herodotus.eurynome.constant.magic.SecurityConstants; -import cn.herodotus.eurynome.constant.magic.ServiceConstants; -import cn.herodotus.eurynome.constant.magic.SymbolConstants; -import cn.herodotus.eurynome.constant.enums.Architecture; +import cn.herodotus.eurynome.common.constant.enums.ProtocolType; +import cn.herodotus.eurynome.common.constant.magic.PropertyConstants; +import cn.herodotus.eurynome.common.constant.magic.SecurityConstants; +import cn.herodotus.eurynome.common.constant.magic.ServiceConstants; +import cn.herodotus.eurynome.common.constant.magic.SymbolConstants; +import cn.herodotus.eurynome.common.constant.enums.Architecture; import com.google.common.base.MoreObjects; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; diff --git a/packages/eurynome-cloud-rest/src/main/java/cn/herodotus/eurynome/rest/properties/RestProperties.java b/packages/eurynome-cloud-rest/src/main/java/cn/herodotus/eurynome/rest/properties/RestProperties.java index 3cc45797f..be375a3e1 100644 --- a/packages/eurynome-cloud-rest/src/main/java/cn/herodotus/eurynome/rest/properties/RestProperties.java +++ b/packages/eurynome-cloud-rest/src/main/java/cn/herodotus/eurynome/rest/properties/RestProperties.java @@ -22,11 +22,10 @@ package cn.herodotus.eurynome.rest.properties; -import cn.herodotus.eurynome.constant.magic.PropertyConstants; +import cn.herodotus.eurynome.common.constant.magic.PropertyConstants; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.web.client.RestTemplate; import java.io.Serializable; import java.util.ArrayList; diff --git a/packages/eurynome-cloud-rest/src/main/java/cn/herodotus/eurynome/rest/properties/ServiceProperties.java b/packages/eurynome-cloud-rest/src/main/java/cn/herodotus/eurynome/rest/properties/ServiceProperties.java index 5d1f830c0..074c3ea2b 100644 --- a/packages/eurynome-cloud-rest/src/main/java/cn/herodotus/eurynome/rest/properties/ServiceProperties.java +++ b/packages/eurynome-cloud-rest/src/main/java/cn/herodotus/eurynome/rest/properties/ServiceProperties.java @@ -23,8 +23,8 @@ package cn.herodotus.eurynome.rest.properties; import cn.herodotus.eurynome.common.utils.ConvertUtils; -import cn.herodotus.eurynome.constant.magic.PropertyConstants; -import cn.herodotus.eurynome.constant.magic.SymbolConstants; +import cn.herodotus.eurynome.common.constant.magic.PropertyConstants; +import cn.herodotus.eurynome.common.constant.magic.SymbolConstants; import com.google.common.base.MoreObjects; import org.apache.commons.lang3.StringUtils; import org.springframework.boot.context.properties.ConfigurationProperties; diff --git a/packages/eurynome-cloud-security/pom.xml b/packages/eurynome-cloud-security/pom.xml index 44a6afedc..8151e6693 100644 --- a/packages/eurynome-cloud-security/pom.xml +++ b/packages/eurynome-cloud-security/pom.xml @@ -29,11 +29,11 @@ packages cn.herodotus.eurynome - 2.5.4.50 + 2.5.4.55 eurynome-cloud-security - 2.5.4.50 + 2.5.4.55 jar diff --git a/packages/eurynome-cloud-security/src/main/java/cn/herodotus/eurynome/security/authentication/access/RequestMappingScanner.java b/packages/eurynome-cloud-security/src/main/java/cn/herodotus/eurynome/security/authentication/access/RequestMappingScanner.java index 85647102c..36f02ec22 100644 --- a/packages/eurynome-cloud-security/src/main/java/cn/herodotus/eurynome/security/authentication/access/RequestMappingScanner.java +++ b/packages/eurynome-cloud-security/src/main/java/cn/herodotus/eurynome/security/authentication/access/RequestMappingScanner.java @@ -23,10 +23,10 @@ package cn.herodotus.eurynome.security.authentication.access; import cn.herodotus.eurynome.assistant.utils.PropertyResolver; -import cn.herodotus.eurynome.constant.enums.Architecture; -import cn.herodotus.eurynome.constant.magic.PlatformConstants; -import cn.herodotus.eurynome.constant.magic.SecurityConstants; -import cn.herodotus.eurynome.constant.magic.SymbolConstants; +import cn.herodotus.eurynome.common.constant.enums.Architecture; +import cn.herodotus.eurynome.common.constant.magic.PlatformConstants; +import cn.herodotus.eurynome.common.constant.magic.SecurityConstants; +import cn.herodotus.eurynome.common.constant.magic.SymbolConstants; import cn.herodotus.eurynome.rest.properties.PlatformProperties; import cn.herodotus.eurynome.rest.properties.RestProperties; import cn.herodotus.eurynome.security.definition.domain.RequestMapping; diff --git a/packages/eurynome-cloud-security/src/main/java/cn/herodotus/eurynome/security/authentication/token/HerodotusJwtTokenEnhancer.java b/packages/eurynome-cloud-security/src/main/java/cn/herodotus/eurynome/security/authentication/token/HerodotusJwtTokenEnhancer.java index 1ee9ebcb5..6e5bfaac7 100644 --- a/packages/eurynome-cloud-security/src/main/java/cn/herodotus/eurynome/security/authentication/token/HerodotusJwtTokenEnhancer.java +++ b/packages/eurynome-cloud-security/src/main/java/cn/herodotus/eurynome/security/authentication/token/HerodotusJwtTokenEnhancer.java @@ -22,7 +22,7 @@ package cn.herodotus.eurynome.security.authentication.token; -import cn.herodotus.eurynome.constant.magic.SecurityConstants; +import cn.herodotus.eurynome.common.constant.magic.SecurityConstants; import cn.herodotus.eurynome.security.definition.core.HerodotusUserDetails; import org.springframework.security.oauth2.common.DefaultOAuth2AccessToken; import org.springframework.security.oauth2.common.OAuth2AccessToken; diff --git a/packages/eurynome-cloud-security/src/main/java/cn/herodotus/eurynome/security/autoconfigure/SecurityAutoConfiguration.java b/packages/eurynome-cloud-security/src/main/java/cn/herodotus/eurynome/security/autoconfigure/SecurityAutoConfiguration.java index 2a565e251..3603e27dc 100644 --- a/packages/eurynome-cloud-security/src/main/java/cn/herodotus/eurynome/security/autoconfigure/SecurityAutoConfiguration.java +++ b/packages/eurynome-cloud-security/src/main/java/cn/herodotus/eurynome/security/autoconfigure/SecurityAutoConfiguration.java @@ -30,6 +30,7 @@ import cn.herodotus.eurynome.security.authentication.token.HerodotusUserAuthenticationConverter; import cn.herodotus.eurynome.security.configuration.MethodSecurityMetadataConfiguration; import cn.herodotus.eurynome.security.properties.SecurityProperties; +import cn.herodotus.eurynome.security.response.exception.SecurityGlobalExceptionHandler; import cn.herodotus.eurynome.security.service.RequestMappingGatherService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -79,6 +80,7 @@ @Import({ MethodSecurityMetadataConfiguration.class }) +@ComponentScan(basePackageClasses = SecurityGlobalExceptionHandler.class) @RemoteApplicationEventScan({ "cn.herodotus.eurynome.security.event.remote" }) diff --git a/packages/eurynome-cloud-security/src/main/java/cn/herodotus/eurynome/security/definition/domain/RequestMapping.java b/packages/eurynome-cloud-security/src/main/java/cn/herodotus/eurynome/security/definition/domain/RequestMapping.java index a5134037d..bdca38f6d 100644 --- a/packages/eurynome-cloud-security/src/main/java/cn/herodotus/eurynome/security/definition/domain/RequestMapping.java +++ b/packages/eurynome-cloud-security/src/main/java/cn/herodotus/eurynome/security/definition/domain/RequestMapping.java @@ -23,7 +23,7 @@ package cn.herodotus.eurynome.security.definition.domain; import cn.herodotus.eurynome.common.definition.entity.AbstractEntity; -import cn.herodotus.eurynome.constant.enums.AuthorityType; +import cn.herodotus.eurynome.common.constant.enums.AuthorityType; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.common.base.MoreObjects; diff --git a/packages/eurynome-cloud-security/src/main/java/cn/herodotus/eurynome/security/properties/SecurityProperties.java b/packages/eurynome-cloud-security/src/main/java/cn/herodotus/eurynome/security/properties/SecurityProperties.java index 9a2de5036..557ce156c 100644 --- a/packages/eurynome-cloud-security/src/main/java/cn/herodotus/eurynome/security/properties/SecurityProperties.java +++ b/packages/eurynome-cloud-security/src/main/java/cn/herodotus/eurynome/security/properties/SecurityProperties.java @@ -22,11 +22,11 @@ package cn.herodotus.eurynome.security.properties; -import cn.herodotus.eurynome.constant.enums.captcha.CaptchaFont; -import cn.herodotus.eurynome.constant.enums.captcha.CaptchaLetterType; -import cn.herodotus.eurynome.constant.enums.captcha.CaptchaType; -import cn.herodotus.eurynome.constant.magic.PropertyConstants; -import cn.herodotus.eurynome.constant.magic.SymbolConstants; +import cn.herodotus.eurynome.common.constant.enums.captcha.CaptchaFont; +import cn.herodotus.eurynome.common.constant.enums.captcha.CaptchaLetterType; +import cn.herodotus.eurynome.common.constant.enums.captcha.CaptchaType; +import cn.herodotus.eurynome.common.constant.magic.PropertyConstants; +import cn.herodotus.eurynome.common.constant.magic.SymbolConstants; import org.springframework.boot.context.properties.ConfigurationProperties; import java.io.Serializable; diff --git a/packages/eurynome-cloud-security/src/main/java/cn/herodotus/eurynome/security/response/exception/SecurityGlobalExceptionHandler.java b/packages/eurynome-cloud-security/src/main/java/cn/herodotus/eurynome/security/response/exception/SecurityGlobalExceptionHandler.java index 621ad292a..0467e08cd 100644 --- a/packages/eurynome-cloud-security/src/main/java/cn/herodotus/eurynome/security/response/exception/SecurityGlobalExceptionHandler.java +++ b/packages/eurynome-cloud-security/src/main/java/cn/herodotus/eurynome/security/response/exception/SecurityGlobalExceptionHandler.java @@ -22,16 +22,22 @@ package cn.herodotus.eurynome.security.response.exception; +import cn.herodotus.eurynome.assistant.exception.HerodotusExceptionHandler; +import cn.herodotus.eurynome.assistant.exception.platform.PlatformException; import cn.herodotus.eurynome.common.domain.Result; -import cn.herodotus.eurynome.common.exception.GlobalExceptionHandler; -import cn.herodotus.eurynome.common.exception.PlatformException; -import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.ObjectUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.security.core.AuthenticationException; import org.springframework.security.oauth2.common.exceptions.ClientAuthenticationException; import org.springframework.security.oauth2.common.exceptions.OAuth2Exception; -import org.springframework.web.bind.annotation.ControllerAdvice; +import org.springframework.validation.BindException; +import org.springframework.validation.BindingResult; +import org.springframework.validation.FieldError; +import org.springframework.web.bind.MethodArgumentNotValidException; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestControllerAdvice; import org.springframework.web.client.HttpClientErrorException; import org.springframework.web.client.HttpServerErrorException; import org.springframework.web.servlet.ModelAndView; @@ -45,9 +51,10 @@ * @author : gengwei.zheng * @date : 2019/11/18 8:12 */ -@Slf4j -@ControllerAdvice -public class SecurityGlobalExceptionHandler extends GlobalExceptionHandler { +@RestControllerAdvice +public class SecurityGlobalExceptionHandler{ + + private static final Logger log = LoggerFactory.getLogger(SecurityGlobalExceptionHandler.class); /** * 定义错误显示页,error.html @@ -64,11 +71,12 @@ public static Result exception(Exception ex, HttpServletRequest request, /** * Rest Template 错误处理 - * @see :https://www.baeldung.com/spring-rest-template-error-handling + * * @param ex * @param request * @param response * @return + * @see :https://www.baeldung.com/spring-rest-template-error-handling */ @ExceptionHandler({HttpClientErrorException.class, HttpServerErrorException.class}) @ResponseBody @@ -111,6 +119,30 @@ public static Result oauth2Exception(Exception ex, HttpServletRequest re return result; } + @ExceptionHandler({MethodArgumentNotValidException.class}) + public static Result validationException(MethodArgumentNotValidException ex, HttpServletRequest request, HttpServletResponse response) { + return validationException(ex, request, response); + } + + @ExceptionHandler({BindException.class}) + public static Result validationException(BindException ex, HttpServletRequest request, HttpServletResponse response) { + Result result = resolveException(ex, request.getRequestURI()); + + BindingResult bindingResult = ex.getBindingResult(); + FieldError fieldError = bindingResult.getFieldError(); + //返回第一个错误的信息 + if (ObjectUtils.isNotEmpty(fieldError)) { + result.validation(fieldError.getDefaultMessage(), fieldError.getCode(), fieldError.getField()); + } + + response.setStatus(result.getStatus()); + return result; + } + + public static Result resolveException(Exception ex, String path) { + return HerodotusExceptionHandler.resolveException(ex, path); + } + /** * 静态解析认证异常 * diff --git a/packages/eurynome-cloud-security/src/main/java/cn/herodotus/eurynome/security/service/RequestMappingGatherService.java b/packages/eurynome-cloud-security/src/main/java/cn/herodotus/eurynome/security/service/RequestMappingGatherService.java index fd15de016..41498c5a3 100644 --- a/packages/eurynome-cloud-security/src/main/java/cn/herodotus/eurynome/security/service/RequestMappingGatherService.java +++ b/packages/eurynome-cloud-security/src/main/java/cn/herodotus/eurynome/security/service/RequestMappingGatherService.java @@ -22,7 +22,7 @@ package cn.herodotus.eurynome.security.service; -import cn.herodotus.eurynome.constant.magic.ServiceConstants; +import cn.herodotus.eurynome.common.constant.magic.ServiceConstants; import cn.herodotus.eurynome.security.authentication.access.RequestMappingLocalCache; import cn.herodotus.eurynome.security.definition.domain.RequestMapping; import cn.herodotus.eurynome.security.event.remote.RemoteRequestMappingGatherEvent; diff --git a/packages/eurynome-cloud-security/src/main/java/cn/herodotus/eurynome/security/utils/WebUtils.java b/packages/eurynome-cloud-security/src/main/java/cn/herodotus/eurynome/security/utils/WebUtils.java index d0d27b3e3..222d9e949 100644 --- a/packages/eurynome-cloud-security/src/main/java/cn/herodotus/eurynome/security/utils/WebUtils.java +++ b/packages/eurynome-cloud-security/src/main/java/cn/herodotus/eurynome/security/utils/WebUtils.java @@ -22,7 +22,7 @@ package cn.herodotus.eurynome.security.utils; -import cn.herodotus.eurynome.constant.magic.SymbolConstants; +import cn.herodotus.eurynome.common.constant.magic.SymbolConstants; import cn.hutool.extra.spring.SpringUtil; import com.alibaba.fastjson.JSON; import com.google.common.net.HttpHeaders; diff --git a/packages/eurynome-cloud-starter/pom.xml b/packages/eurynome-cloud-starter/pom.xml index f18c56a6d..4e198b691 100644 --- a/packages/eurynome-cloud-starter/pom.xml +++ b/packages/eurynome-cloud-starter/pom.xml @@ -29,11 +29,11 @@ packages cn.herodotus.eurynome - 2.5.4.50 + 2.5.4.55 eurynome-cloud-starter - 2.5.4.50 + 2.5.4.55 通用配置starter,此包的定位是统一未来接入的微服务使用 jar diff --git a/packages/pom.xml b/packages/pom.xml index 641e58e9d..0b76ae24d 100644 --- a/packages/pom.xml +++ b/packages/pom.xml @@ -29,7 +29,7 @@ eurynome-cloud cn.herodotus.eurynome - 2.5.4.50 + 2.5.4.55 packages @@ -47,7 +47,6 @@ eurynome-cloud-kernel eurynome-cloud-oauth eurynome-cloud-oauth-starter - eurynome-cloud-constant eurynome-cloud-assistant diff --git a/platform/eurynome-cloud-gateway/pom.xml b/platform/eurynome-cloud-gateway/pom.xml index 0cdbf3c19..e421e03b3 100644 --- a/platform/eurynome-cloud-gateway/pom.xml +++ b/platform/eurynome-cloud-gateway/pom.xml @@ -29,11 +29,11 @@ platform cn.herodotus.eurynome - 2.5.4.50 + 2.5.4.55 eurynome-cloud-gateway - 2.5.4.50 + 2.5.4.55 jar diff --git a/platform/eurynome-cloud-gateway/src/main/java/cn/herodotus/eurynome/gateway/exception/GatewayGlobalExceptionHandler.java b/platform/eurynome-cloud-gateway/src/main/java/cn/herodotus/eurynome/gateway/exception/GatewayGlobalExceptionHandler.java index dd82f7ea8..7a344c365 100644 --- a/platform/eurynome-cloud-gateway/src/main/java/cn/herodotus/eurynome/gateway/exception/GatewayGlobalExceptionHandler.java +++ b/platform/eurynome-cloud-gateway/src/main/java/cn/herodotus/eurynome/gateway/exception/GatewayGlobalExceptionHandler.java @@ -23,8 +23,8 @@ package cn.herodotus.eurynome.gateway.exception; import cn.herodotus.eurynome.common.domain.Result; -import cn.herodotus.eurynome.constant.enums.ResultStatus; -import cn.herodotus.eurynome.common.exception.GlobalExceptionHandler; +import cn.herodotus.eurynome.common.constant.enums.ResultStatus; +import cn.herodotus.eurynome.assistant.exception.HerodotusExceptionHandler; import lombok.extern.slf4j.Slf4j; import org.springframework.boot.web.reactive.error.ErrorWebExceptionHandler; import org.springframework.cloud.gateway.support.NotFoundException; @@ -128,7 +128,7 @@ public Mono handle(ServerWebExchange exchange, Throwable ex) { log.error("[Eurynome] |- ERROR ==> Response Status Exception : {}", result); } else { - result = GlobalExceptionHandler.resolveException((Exception) ex, path); + result = HerodotusExceptionHandler.resolveException((Exception) ex, path); } /** diff --git a/platform/eurynome-cloud-gateway/src/main/java/cn/herodotus/eurynome/gateway/filter/GlobalCertificationFilter.java b/platform/eurynome-cloud-gateway/src/main/java/cn/herodotus/eurynome/gateway/filter/GlobalCertificationFilter.java index ca99c5a86..0934010d2 100644 --- a/platform/eurynome-cloud-gateway/src/main/java/cn/herodotus/eurynome/gateway/filter/GlobalCertificationFilter.java +++ b/platform/eurynome-cloud-gateway/src/main/java/cn/herodotus/eurynome/gateway/filter/GlobalCertificationFilter.java @@ -22,9 +22,9 @@ package cn.herodotus.eurynome.gateway.filter; -import cn.herodotus.eurynome.constant.magic.SecurityConstants; +import cn.herodotus.eurynome.common.constant.magic.SecurityConstants; import cn.herodotus.eurynome.common.domain.Result; -import cn.herodotus.eurynome.constant.enums.ResultStatus; +import cn.herodotus.eurynome.common.constant.enums.ResultStatus; import cn.herodotus.eurynome.gateway.properties.GatewaySecurityProperties; import cn.herodotus.eurynome.gateway.utils.WebFluxUtils; import lombok.extern.slf4j.Slf4j; diff --git a/platform/eurynome-cloud-management/pom.xml b/platform/eurynome-cloud-management/pom.xml index dd29590ce..f1517c629 100644 --- a/platform/eurynome-cloud-management/pom.xml +++ b/platform/eurynome-cloud-management/pom.xml @@ -29,11 +29,11 @@ platform cn.herodotus.eurynome - 2.5.4.50 + 2.5.4.55 eurynome-cloud-management - 2.5.4.50 + 2.5.4.55 jar diff --git a/platform/eurynome-cloud-uaa/pom.xml b/platform/eurynome-cloud-uaa/pom.xml index 9213a4597..aeda04324 100644 --- a/platform/eurynome-cloud-uaa/pom.xml +++ b/platform/eurynome-cloud-uaa/pom.xml @@ -29,11 +29,11 @@ platform cn.herodotus.eurynome - 2.5.4.50 + 2.5.4.55 eurynome-cloud-uaa - 2.5.4.50 + 2.5.4.55 jar diff --git a/platform/pom.xml b/platform/pom.xml index 2bc9688dd..726964623 100644 --- a/platform/pom.xml +++ b/platform/pom.xml @@ -29,7 +29,7 @@ eurynome-cloud cn.herodotus.eurynome - 2.5.4.50 + 2.5.4.55 4.0.0 diff --git a/pom.xml b/pom.xml index 7e7d82c15..3bcd97f63 100644 --- a/pom.xml +++ b/pom.xml @@ -7,12 +7,12 @@ cn.herodotus.eurynome dependencies - 2.5.4.50 + 2.5.4.55 dependencies/pom.xml eurynome-cloud - 2.5.4.50 + 2.5.4.55 pom eurynome-cloud diff --git a/services/eurynome-cloud-bpmn-ability/pom.xml b/services/eurynome-cloud-bpmn-ability/pom.xml index a813b922b..fc6f2aa1f 100644 --- a/services/eurynome-cloud-bpmn-ability/pom.xml +++ b/services/eurynome-cloud-bpmn-ability/pom.xml @@ -27,12 +27,12 @@ services cn.herodotus.eurynome - 2.5.4.50 + 2.5.4.55 4.0.0 eurynome-cloud-bpmn-ability - 2.5.4.50 + 2.5.4.55 基于Camunda工作流的服务 diff --git a/services/eurynome-cloud-bpmn-rest/pom.xml b/services/eurynome-cloud-bpmn-rest/pom.xml index e245e3db8..b4d7fd8fc 100644 --- a/services/eurynome-cloud-bpmn-rest/pom.xml +++ b/services/eurynome-cloud-bpmn-rest/pom.xml @@ -27,12 +27,12 @@ services cn.herodotus.eurynome - 2.5.4.50 + 2.5.4.55 4.0.0 eurynome-cloud-bpmn-rest - 2.5.4.50 + 2.5.4.55 jar diff --git a/services/eurynome-cloud-upms-ability/pom.xml b/services/eurynome-cloud-upms-ability/pom.xml index a64fd6b01..2ad754e0e 100644 --- a/services/eurynome-cloud-upms-ability/pom.xml +++ b/services/eurynome-cloud-upms-ability/pom.xml @@ -27,12 +27,12 @@ services cn.herodotus.eurynome - 2.5.4.50 + 2.5.4.55 4.0.0 eurynome-cloud-upms-ability - 2.5.4.50 + 2.5.4.55 diff --git a/services/eurynome-cloud-upms-api/pom.xml b/services/eurynome-cloud-upms-api/pom.xml index 34d263ba0..5a46f5604 100644 --- a/services/eurynome-cloud-upms-api/pom.xml +++ b/services/eurynome-cloud-upms-api/pom.xml @@ -29,11 +29,11 @@ services cn.herodotus.eurynome - 2.5.4.50 + 2.5.4.55 eurynome-cloud-upms-api - 2.5.4.50 + 2.5.4.55 diff --git a/services/eurynome-cloud-upms-api/src/main/java/cn/herodotus/eurynome/upms/api/constants/UpmsConstants.java b/services/eurynome-cloud-upms-api/src/main/java/cn/herodotus/eurynome/upms/api/constants/UpmsConstants.java index 5e2a29e50..d6938b19a 100644 --- a/services/eurynome-cloud-upms-api/src/main/java/cn/herodotus/eurynome/upms/api/constants/UpmsConstants.java +++ b/services/eurynome-cloud-upms-api/src/main/java/cn/herodotus/eurynome/upms/api/constants/UpmsConstants.java @@ -22,11 +22,11 @@ package cn.herodotus.eurynome.upms.api.constants; -import cn.herodotus.eurynome.constant.enums.OAuth2Expression; -import cn.herodotus.eurynome.constant.enums.StatusEnum; -import cn.herodotus.eurynome.constant.magic.CacheConstants; -import cn.herodotus.eurynome.constant.enums.GrantType; -import cn.herodotus.eurynome.constant.enums.ApplicationType; +import cn.herodotus.eurynome.common.constant.enums.OAuth2Expression; +import cn.herodotus.eurynome.common.constant.enums.StatusEnum; +import cn.herodotus.eurynome.common.constant.magic.CacheConstants; +import cn.herodotus.eurynome.common.constant.enums.GrantType; +import cn.herodotus.eurynome.common.constant.enums.ApplicationType; import cn.herodotus.eurynome.upms.api.constants.enums.Gender; import cn.herodotus.eurynome.upms.api.constants.enums.Identity; import cn.herodotus.eurynome.upms.api.constants.enums.SupplierType; diff --git a/services/eurynome-cloud-upms-api/src/main/java/cn/herodotus/eurynome/upms/api/entity/oauth/OauthClientDetails.java b/services/eurynome-cloud-upms-api/src/main/java/cn/herodotus/eurynome/upms/api/entity/oauth/OauthClientDetails.java index 87908d04d..4bb0c1125 100644 --- a/services/eurynome-cloud-upms-api/src/main/java/cn/herodotus/eurynome/upms/api/entity/oauth/OauthClientDetails.java +++ b/services/eurynome-cloud-upms-api/src/main/java/cn/herodotus/eurynome/upms/api/entity/oauth/OauthClientDetails.java @@ -22,7 +22,7 @@ package cn.herodotus.eurynome.upms.api.entity.oauth; -import cn.herodotus.eurynome.constant.enums.StatusEnum; +import cn.herodotus.eurynome.common.constant.enums.StatusEnum; import cn.herodotus.eurynome.common.definition.entity.AbstractEntity; import cn.herodotus.eurynome.upms.api.constants.UpmsConstants; import com.alibaba.fastjson.JSON; diff --git a/services/eurynome-cloud-upms-api/src/main/java/cn/herodotus/eurynome/upms/api/entity/system/SysAuthority.java b/services/eurynome-cloud-upms-api/src/main/java/cn/herodotus/eurynome/upms/api/entity/system/SysAuthority.java index 0c71214a4..16902cbcf 100644 --- a/services/eurynome-cloud-upms-api/src/main/java/cn/herodotus/eurynome/upms/api/entity/system/SysAuthority.java +++ b/services/eurynome-cloud-upms-api/src/main/java/cn/herodotus/eurynome/upms/api/entity/system/SysAuthority.java @@ -22,7 +22,7 @@ package cn.herodotus.eurynome.upms.api.entity.system; -import cn.herodotus.eurynome.constant.enums.AuthorityType; +import cn.herodotus.eurynome.common.constant.enums.AuthorityType; import cn.herodotus.eurynome.data.base.entity.BaseSysEntity; import cn.herodotus.eurynome.upms.api.constants.UpmsConstants; import org.apache.commons.lang3.builder.EqualsBuilder; diff --git a/services/eurynome-cloud-upms-api/src/main/java/cn/herodotus/eurynome/upms/api/entity/system/SysDefaultRole.java b/services/eurynome-cloud-upms-api/src/main/java/cn/herodotus/eurynome/upms/api/entity/system/SysDefaultRole.java index d80d214a3..252d44f64 100644 --- a/services/eurynome-cloud-upms-api/src/main/java/cn/herodotus/eurynome/upms/api/entity/system/SysDefaultRole.java +++ b/services/eurynome-cloud-upms-api/src/main/java/cn/herodotus/eurynome/upms/api/entity/system/SysDefaultRole.java @@ -23,7 +23,7 @@ package cn.herodotus.eurynome.upms.api.entity.system; import cn.herodotus.eurynome.data.base.entity.BaseSysEntity; -import cn.herodotus.eurynome.constant.enums.AccountType; +import cn.herodotus.eurynome.common.constant.enums.AccountType; import cn.herodotus.eurynome.upms.api.constants.UpmsConstants; import com.google.common.base.MoreObjects; import io.swagger.annotations.ApiModelProperty; diff --git a/services/eurynome-cloud-upms-api/src/main/java/cn/herodotus/eurynome/upms/api/helper/UpmsHelper.java b/services/eurynome-cloud-upms-api/src/main/java/cn/herodotus/eurynome/upms/api/helper/UpmsHelper.java index bada55d81..314a5c3ff 100644 --- a/services/eurynome-cloud-upms-api/src/main/java/cn/herodotus/eurynome/upms/api/helper/UpmsHelper.java +++ b/services/eurynome-cloud-upms-api/src/main/java/cn/herodotus/eurynome/upms/api/helper/UpmsHelper.java @@ -23,8 +23,8 @@ package cn.herodotus.eurynome.upms.api.helper; -import cn.herodotus.eurynome.constant.enums.StatusEnum; -import cn.herodotus.eurynome.constant.magic.SymbolConstants; +import cn.herodotus.eurynome.common.constant.enums.StatusEnum; +import cn.herodotus.eurynome.common.constant.magic.SymbolConstants; import cn.herodotus.eurynome.security.definition.core.HerodotusClientDetails; import cn.herodotus.eurynome.security.definition.core.HerodotusUserDetails; import cn.herodotus.eurynome.security.definition.domain.RequestMapping; diff --git a/services/eurynome-cloud-upms-logic/pom.xml b/services/eurynome-cloud-upms-logic/pom.xml index 2871bc8f5..1e892093f 100644 --- a/services/eurynome-cloud-upms-logic/pom.xml +++ b/services/eurynome-cloud-upms-logic/pom.xml @@ -7,11 +7,11 @@ services cn.herodotus.eurynome - 2.5.4.50 + 2.5.4.55 eurynome-cloud-upms-logic - 2.5.4.50 + 2.5.4.55 diff --git a/services/eurynome-cloud-upms-logic/src/main/java/cn/herodotus/eurynome/upms/logic/repository/system/SysAuthorityRepository.java b/services/eurynome-cloud-upms-logic/src/main/java/cn/herodotus/eurynome/upms/logic/repository/system/SysAuthorityRepository.java index 07ce72fde..8d216ad48 100644 --- a/services/eurynome-cloud-upms-logic/src/main/java/cn/herodotus/eurynome/upms/logic/repository/system/SysAuthorityRepository.java +++ b/services/eurynome-cloud-upms-logic/src/main/java/cn/herodotus/eurynome/upms/logic/repository/system/SysAuthorityRepository.java @@ -24,7 +24,7 @@ package cn.herodotus.eurynome.upms.logic.repository.system; -import cn.herodotus.eurynome.constant.enums.AuthorityType; +import cn.herodotus.eurynome.common.constant.enums.AuthorityType; import cn.herodotus.eurynome.data.base.repository.BaseRepository; import cn.herodotus.eurynome.upms.api.entity.system.SysAuthority; import org.springframework.data.jpa.repository.QueryHints; diff --git a/services/eurynome-cloud-upms-logic/src/main/java/cn/herodotus/eurynome/upms/logic/repository/system/SysDefaultRoleRepository.java b/services/eurynome-cloud-upms-logic/src/main/java/cn/herodotus/eurynome/upms/logic/repository/system/SysDefaultRoleRepository.java index 8790692c7..bd8721020 100644 --- a/services/eurynome-cloud-upms-logic/src/main/java/cn/herodotus/eurynome/upms/logic/repository/system/SysDefaultRoleRepository.java +++ b/services/eurynome-cloud-upms-logic/src/main/java/cn/herodotus/eurynome/upms/logic/repository/system/SysDefaultRoleRepository.java @@ -23,7 +23,7 @@ package cn.herodotus.eurynome.upms.logic.repository.system; import cn.herodotus.eurynome.data.base.repository.BaseRepository; -import cn.herodotus.eurynome.constant.enums.AccountType; +import cn.herodotus.eurynome.common.constant.enums.AccountType; import cn.herodotus.eurynome.upms.api.entity.system.SysDefaultRole; import org.springframework.data.jpa.repository.QueryHints; diff --git a/services/eurynome-cloud-upms-logic/src/main/java/cn/herodotus/eurynome/upms/logic/service/system/SysAuthorityService.java b/services/eurynome-cloud-upms-logic/src/main/java/cn/herodotus/eurynome/upms/logic/service/system/SysAuthorityService.java index b561f656d..fd9b1e636 100644 --- a/services/eurynome-cloud-upms-logic/src/main/java/cn/herodotus/eurynome/upms/logic/service/system/SysAuthorityService.java +++ b/services/eurynome-cloud-upms-logic/src/main/java/cn/herodotus/eurynome/upms/logic/service/system/SysAuthorityService.java @@ -24,7 +24,7 @@ package cn.herodotus.eurynome.upms.logic.service.system; -import cn.herodotus.eurynome.constant.enums.AuthorityType; +import cn.herodotus.eurynome.common.constant.enums.AuthorityType; import cn.herodotus.eurynome.crud.service.BaseLayeredService; import cn.herodotus.eurynome.data.base.repository.BaseRepository; import cn.herodotus.eurynome.upms.api.entity.system.SysAuthority; diff --git a/services/eurynome-cloud-upms-logic/src/main/java/cn/herodotus/eurynome/upms/logic/service/system/SysDefaultRoleService.java b/services/eurynome-cloud-upms-logic/src/main/java/cn/herodotus/eurynome/upms/logic/service/system/SysDefaultRoleService.java index 97a059b87..8df5b18ba 100644 --- a/services/eurynome-cloud-upms-logic/src/main/java/cn/herodotus/eurynome/upms/logic/service/system/SysDefaultRoleService.java +++ b/services/eurynome-cloud-upms-logic/src/main/java/cn/herodotus/eurynome/upms/logic/service/system/SysDefaultRoleService.java @@ -24,7 +24,7 @@ import cn.herodotus.eurynome.crud.service.BaseLayeredService; import cn.herodotus.eurynome.data.base.repository.BaseRepository; -import cn.herodotus.eurynome.constant.enums.AccountType; +import cn.herodotus.eurynome.common.constant.enums.AccountType; import cn.herodotus.eurynome.upms.api.entity.system.SysDefaultRole; import cn.herodotus.eurynome.upms.logic.repository.system.SysDefaultRoleRepository; import org.slf4j.Logger; diff --git a/services/eurynome-cloud-upms-rest/pom.xml b/services/eurynome-cloud-upms-rest/pom.xml index 40e815699..556c54f8d 100644 --- a/services/eurynome-cloud-upms-rest/pom.xml +++ b/services/eurynome-cloud-upms-rest/pom.xml @@ -6,11 +6,11 @@ services cn.herodotus.eurynome - 2.5.4.50 + 2.5.4.55 eurynome-cloud-upms-rest - 2.5.4.50 + 2.5.4.55 eurynome-cloud-upms-rest 通用权限,人员信息服务供应商 diff --git a/services/eurynome-cloud-upms-rest/src/main/java/cn/herodotus/eurynome/upms/rest/controller/system/SysAuthorityController.java b/services/eurynome-cloud-upms-rest/src/main/java/cn/herodotus/eurynome/upms/rest/controller/system/SysAuthorityController.java index 19f955e1b..31b919890 100644 --- a/services/eurynome-cloud-upms-rest/src/main/java/cn/herodotus/eurynome/upms/rest/controller/system/SysAuthorityController.java +++ b/services/eurynome-cloud-upms-rest/src/main/java/cn/herodotus/eurynome/upms/rest/controller/system/SysAuthorityController.java @@ -24,14 +24,16 @@ package cn.herodotus.eurynome.upms.rest.controller.system; +import cn.herodotus.eurynome.common.constant.magic.PlatformConstants; import cn.herodotus.eurynome.common.domain.Result; -import cn.herodotus.eurynome.common.domain.TreeNode; -import cn.herodotus.eurynome.constant.enums.AuthorityType; -import cn.herodotus.eurynome.common.utils.TreeUtils; +import cn.herodotus.eurynome.common.constant.enums.AuthorityType; import cn.herodotus.eurynome.crud.controller.BaseWriteableRestController; import cn.herodotus.eurynome.crud.service.WriteableService; import cn.herodotus.eurynome.upms.api.entity.system.SysAuthority; import cn.herodotus.eurynome.upms.logic.service.system.SysAuthorityService; +import cn.hutool.core.lang.tree.Tree; +import cn.hutool.core.lang.tree.TreeNode; +import cn.hutool.core.lang.tree.TreeUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.collections4.CollectionUtils; @@ -68,19 +70,19 @@ public WriteableService getWriteableService() { @ApiOperation(value = "获取权限树", notes = "获取权限树形数据") @GetMapping("/tree") - public Result> findTree() { - Result> result = new Result<>(); + public Result>> findTree() { + Result>> result = new Result<>(); List sysAuthorities = sysAuthorityService.findAll(); if (CollectionUtils.isNotEmpty(sysAuthorities)) { - List treeNodes = sysAuthorities.stream().map(sysAuthority -> { - TreeNode treeNode = new TreeNode(); + List> treeNodes = sysAuthorities.stream().map(sysAuthority -> { + TreeNode treeNode = new TreeNode<>(); treeNode.setId(sysAuthority.getAuthorityId()); treeNode.setName(sysAuthority.getAuthorityName()); treeNode.setParentId(sysAuthority.getParentId()); return treeNode; }).collect(Collectors.toList()); - return result.data(TreeUtils.build(treeNodes)); + return result.data(TreeUtil.build(treeNodes, PlatformConstants.DEFAULT_TREE_ROOT_ID)); } else { return result.message("获取数据失败"); } diff --git a/services/pom.xml b/services/pom.xml index e0e09cad1..c851d866d 100644 --- a/services/pom.xml +++ b/services/pom.xml @@ -31,7 +31,7 @@ eurynome-cloud cn.herodotus.eurynome - 2.5.4.50 + 2.5.4.55 services