From d75743e7009c6be3ba099554f811a95128f6befe Mon Sep 17 00:00:00 2001 From: Hamm Date: Mon, 8 Jul 2024 15:32:00 +0800 Subject: [PATCH 01/12] docs(AirPower4J): add supported companies in README Signed-off-by: Hamm --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index f7f224d..c661cac 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,18 @@ via [Gitee](https://gitee.com/air-power/AirPowerJavaStarter/blob/main/README.md) > ☕️Java: 加瓦? 什么Java? +## 服务中的企业/用户 + +**AirPower4J** 正在为以下的公司/用户提供技术支持: + +- **杭州某财税网络科技有限公司** + +- **重庆某工业互联网科技有限公司** + +> 如果你的公司/企业正在使用我们的服务,欢迎通过 `Issues` 提交,我们将在上面的列表中列出。 + +--- + ---

-- Gitee From b570e65b9be9f5ce06720833335ee3a05329700b Mon Sep 17 00:00:00 2001 From: Hamm Date: Tue, 9 Jul 2024 14:02:21 +0800 Subject: [PATCH 02/12] =?UTF-8?q?fix(RootModel):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E4=BA=86`Expose`=E5=92=8C`Exclude`=E7=9A=84=E5=A4=84=E7=90=86?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Hamm --- .../cn/hamm/airpower/annotation/Exclude.java | 2 +- .../cn/hamm/airpower/annotation/Expose.java | 2 +- .../java/cn/hamm/airpower/root/RootModel.java | 48 ++++++++++++++----- 3 files changed, 39 insertions(+), 13 deletions(-) diff --git a/airpower-core/src/main/java/cn/hamm/airpower/annotation/Exclude.java b/airpower-core/src/main/java/cn/hamm/airpower/annotation/Exclude.java index a9a2aaa..c6496e0 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/annotation/Exclude.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/annotation/Exclude.java @@ -9,7 +9,7 @@ import java.lang.annotation.*; * @apiNote 控制器标记了 {@link Filter} 并指定使用的过滤器后,使用此注解标记了相同装饰器的属性将不会被接口输出。 * 也可类标记此注解,然后通过 {@link Expose} 输出部分的属性。 */ -@Target({ElementType.FIELD, ElementType.TYPE}) +@Target({ElementType.FIELD, ElementType.TYPE, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) @Documented public @interface Exclude { diff --git a/airpower-core/src/main/java/cn/hamm/airpower/annotation/Expose.java b/airpower-core/src/main/java/cn/hamm/airpower/annotation/Expose.java index b0516ca..99b6a79 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/annotation/Expose.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/annotation/Expose.java @@ -8,7 +8,7 @@ import java.lang.annotation.*; * @author Hamm.cn * @apiNote 此注解用于类标记了全部忽略后, 需要对部分字段进行暴露的场景。可参考 {@link Exclude} */ -@Target({ElementType.FIELD, ElementType.TYPE}) +@Target({ElementType.FIELD, ElementType.TYPE, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) @Documented public @interface Expose { diff --git a/airpower-core/src/main/java/cn/hamm/airpower/root/RootModel.java b/airpower-core/src/main/java/cn/hamm/airpower/root/RootModel.java index fc4a8e0..9e2a70f 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/root/RootModel.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/root/RootModel.java @@ -1,6 +1,7 @@ package cn.hamm.airpower.root; import cn.hamm.airpower.annotation.*; +import cn.hamm.airpower.config.Constant; import cn.hamm.airpower.exception.ServiceException; import cn.hamm.airpower.interfaces.IAction; import cn.hamm.airpower.util.CollectionUtil; @@ -14,8 +15,10 @@ import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.springframework.beans.BeanUtils; +import org.springframework.util.StringUtils; import java.lang.reflect.Field; +import java.lang.reflect.Method; import java.util.Arrays; import java.util.Collection; import java.util.List; @@ -144,11 +147,24 @@ public class RootModel> implements IAction { * @param filterClass 过滤器 */ private void excludeBy(@NotNull Field field, @NotNull Class filterClass) { - Exclude fieldExclude = reflectUtil.getAnnotation(Exclude.class, field); - if (Objects.isNull(fieldExclude)) { - return; + Class[] excludeClasses = null; + final String fieldGetter = Constant.GET + StringUtils.capitalize(field.getName()); + try { + Method getMethod = getClass().getMethod(fieldGetter); + Exclude methodExclude = reflectUtil.getAnnotation(Exclude.class, getMethod); + if (Objects.nonNull(methodExclude)) { + excludeClasses = methodExclude.filters(); + } + } catch (NoSuchMethodException exception) { + log.error(exception.getMessage(), exception); + } + if (Objects.isNull(excludeClasses)) { + Exclude fieldExclude = reflectUtil.getAnnotation(Exclude.class, field); + if (Objects.isNull(fieldExclude)) { + return; + } + excludeClasses = fieldExclude.filters(); } - Class[] excludeClasses = fieldExclude.filters(); boolean isNeedClear = true; if (excludeClasses.length > 0) { @@ -166,14 +182,24 @@ public class RootModel> implements IAction { * @param filterClass 过滤器 */ private void exposeBy(@NotNull Field field, @NotNull Class filterClass) { - Expose fieldExpose = reflectUtil.getAnnotation(Expose.class, field); - if (Objects.isNull(fieldExpose)) { - // 没有标记 则直接移除掉 - reflectUtil.clearFieldValue(this, field); - return; + Class[] exposeClasses = null; + final String fieldGetter = Constant.GET + StringUtils.capitalize(field.getName()); + try { + Method getMethod = getClass().getMethod(fieldGetter); + Expose methodExpose = reflectUtil.getAnnotation(Expose.class, getMethod); + if (Objects.nonNull(methodExpose)) { + exposeClasses = methodExpose.filters(); + } + } catch (NoSuchMethodException exception) { + log.error(exception.getMessage(), exception); + } + if (Objects.isNull(exposeClasses)) { + Expose fieldExpose = reflectUtil.getAnnotation(Expose.class, field); + if (Objects.isNull(fieldExpose)) { + return; + } + exposeClasses = fieldExpose.filters(); } - Class[] exposeClasses = fieldExpose.filters(); - if (exposeClasses.length == 0) { return; } -- Gitee From 2ab17f46797a05bffc242a34166f4ed696b5578b Mon Sep 17 00:00:00 2001 From: Hamm Date: Tue, 9 Jul 2024 14:45:23 +0800 Subject: [PATCH 03/12] =?UTF-8?q?fix(RootModel):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E4=BA=86`Expose`=E5=92=8C`Exclude`=E7=9A=84=E5=A4=84=E7=90=86?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Hamm --- .../src/main/java/cn/hamm/airpower/root/RootModel.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/airpower-core/src/main/java/cn/hamm/airpower/root/RootModel.java b/airpower-core/src/main/java/cn/hamm/airpower/root/RootModel.java index 9e2a70f..ec68beb 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/root/RootModel.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/root/RootModel.java @@ -161,6 +161,7 @@ public class RootModel> implements IAction { if (Objects.isNull(excludeClasses)) { Exclude fieldExclude = reflectUtil.getAnnotation(Exclude.class, field); if (Objects.isNull(fieldExclude)) { + reflectUtil.clearFieldValue(this, field); return; } excludeClasses = fieldExclude.filters(); @@ -171,7 +172,7 @@ public class RootModel> implements IAction { isNeedClear = Arrays.asList(excludeClasses).contains(filterClass); } if (isNeedClear) { - Utils.getReflectUtil().clearFieldValue(this, field); + reflectUtil.clearFieldValue(this, field); } } -- Gitee From 65c75c548894e89248141a65c2448f94919c2c70 Mon Sep 17 00:00:00 2001 From: Hamm Date: Tue, 9 Jul 2024 14:52:31 +0800 Subject: [PATCH 04/12] refactor(server): replace code blocks with markdown in javadocs Signed-off-by: Hamm --- .../cn/hamm/airpower/AbstractWebConfig.java | 8 +- .../airpower/annotation/ApiController.java | 2 +- .../cn/hamm/airpower/annotation/ReadOnly.java | 2 +- .../cn/hamm/airpower/annotation/Search.java | 4 +- .../hamm/airpower/auto/RedisConfigurer.java | 4 +- .../java/cn/hamm/airpower/config/Configs.java | 8 +- .../cn/hamm/airpower/config/Constant.java | 90 +++++++++---------- .../cn/hamm/airpower/config/CookieConfig.java | 12 +-- .../cn/hamm/airpower/config/MqttConfig.java | 2 +- .../hamm/airpower/config/ServiceConfig.java | 14 +-- .../hamm/airpower/config/WebSocketConfig.java | 12 +-- .../cn/hamm/airpower/enums/ContentType.java | 12 +-- .../cn/hamm/airpower/enums/HttpMethod.java | 10 +-- .../AbstractRequestInterceptor.java | 4 +- .../interceptor/ExceptionInterceptor.java | 4 +- .../interceptor/ResponseBodyInterceptor.java | 2 +- .../hamm/airpower/interfaces/IDictionary.java | 12 +-- .../cn/hamm/airpower/interfaces/IEntity.java | 8 +- .../airpower/interfaces/IEntityAction.java | 2 +- .../cn/hamm/airpower/interfaces/IFile.java | 8 +- .../hamm/airpower/interfaces/IFunction.java | 2 +- .../cn/hamm/airpower/interfaces/ITree.java | 8 +- .../java/cn/hamm/airpower/model/Json.java | 48 +++++----- .../java/cn/hamm/airpower/open/IOpenApp.java | 8 +- .../hamm/airpower/open/IOpenAppService.java | 6 +- .../hamm/airpower/open/IOpenLogService.java | 4 +- .../java/cn/hamm/airpower/open/OpenApi.java | 2 +- .../cn/hamm/airpower/open/OpenApiAspect.java | 18 ++-- .../airpower/open/OpenArithmeticType.java | 4 +- .../cn/hamm/airpower/open/OpenBaseModel.java | 2 +- .../cn/hamm/airpower/open/OpenRequest.java | 4 +- .../cn/hamm/airpower/open/OpenResponse.java | 2 +- .../airpower/resolver/AccessResolver.java | 2 +- .../cn/hamm/airpower/root/RootController.java | 2 +- .../cn/hamm/airpower/root/RootEntity.java | 16 ++-- .../airpower/root/RootEntityController.java | 18 ++-- .../cn/hamm/airpower/root/RootService.java | 74 +++++++-------- .../java/cn/hamm/airpower/util/AesUtil.java | 14 +-- .../cn/hamm/airpower/util/CollectionUtil.java | 2 +- .../cn/hamm/airpower/util/CookieUtil.java | 10 +-- .../cn/hamm/airpower/util/DictionaryUtil.java | 4 +- .../java/cn/hamm/airpower/util/HttpUtil.java | 28 +++--- .../java/cn/hamm/airpower/util/MqttUtil.java | 8 +- .../cn/hamm/airpower/util/PasswordUtil.java | 2 +- .../java/cn/hamm/airpower/util/RedisUtil.java | 26 +++--- .../cn/hamm/airpower/util/ReflectUtil.java | 12 +-- .../java/cn/hamm/airpower/util/RsaUtil.java | 24 ++--- .../cn/hamm/airpower/util/SecurityUtil.java | 10 +-- .../cn/hamm/airpower/util/StringUtil.java | 14 +-- .../java/cn/hamm/airpower/util/TaskUtil.java | 4 +- .../java/cn/hamm/airpower/util/TokenUtil.java | 36 ++++---- .../java/cn/hamm/airpower/util/TreeUtil.java | 2 +- .../java/cn/hamm/airpower/util/Utils.java | 16 ++-- .../cn/hamm/airpower/util/ValidateUtil.java | 4 +- .../airpower/websocket/WebSocketEvent.java | 16 ++-- .../airpower/websocket/WebSocketHandler.java | 54 +++++------ .../airpower/websocket/WebSocketPayload.java | 2 +- .../airpower/websocket/WebSocketSupport.java | 6 +- .../airpower/websocket/WebsocketUtil.java | 2 +- 59 files changed, 368 insertions(+), 368 deletions(-) diff --git a/airpower-core/src/main/java/cn/hamm/airpower/AbstractWebConfig.java b/airpower-core/src/main/java/cn/hamm/airpower/AbstractWebConfig.java index b7a3301..0e76876 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/AbstractWebConfig.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/AbstractWebConfig.java @@ -48,9 +48,9 @@ public abstract class AbstractWebConfig implements WebMvcConfigurer, WebSocketCo public abstract AbstractRequestInterceptor getAccessInterceptor(); /** - *

获取一个 WebSocketHandler

+ *

获取一个 {@code WebSocketHandler}

* - * @return WebSocketHandler + * @return {@code WebSocketHandler} */ @Bean public WebSocketHandler getWebsocketHandler() { @@ -103,9 +103,9 @@ public abstract class AbstractWebConfig implements WebMvcConfigurer, WebSocketCo } /** - *

添加 WebSocket 服务监听

+ *

添加 {@code WebSocket} 服务监听

* - * @param registry WebSocketHandlerRegistry + * @param registry {@code WebSocketHandlerRegistry} */ @Override public final void registerWebSocketHandlers(@NotNull WebSocketHandlerRegistry registry) { diff --git a/airpower-core/src/main/java/cn/hamm/airpower/annotation/ApiController.java b/airpower-core/src/main/java/cn/hamm/airpower/annotation/ApiController.java index fa9e438..8a23b4b 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/annotation/ApiController.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/annotation/ApiController.java @@ -7,7 +7,7 @@ import org.springframework.web.bind.annotation.RestController; import java.lang.annotation.*; /** - *

API 控制器

+ *

{@code API} 控制器

* * @author Hamm.cn */ diff --git a/airpower-core/src/main/java/cn/hamm/airpower/annotation/ReadOnly.java b/airpower-core/src/main/java/cn/hamm/airpower/annotation/ReadOnly.java index 78b19e7..8920ccb 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/annotation/ReadOnly.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/annotation/ReadOnly.java @@ -8,7 +8,7 @@ import java.lang.annotation.*; *

只读字段

* * @author Hamm.cn - * @apiNote 可在控制器调用 Service 前先调用 {@link RootModel#ignoreReadOnlyFields()} } 将标记了此注解的字段移除 + * @apiNote 可在控制器调用 {@code Service} 前先调用 {@link RootModel#ignoreReadOnlyFields()} } 将标记了此注解的字段移除 */ @Target(ElementType.FIELD) @Retention(RetentionPolicy.RUNTIME) diff --git a/airpower-core/src/main/java/cn/hamm/airpower/annotation/Search.java b/airpower-core/src/main/java/cn/hamm/airpower/annotation/Search.java index 14109fe..c51160e 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/annotation/Search.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/annotation/Search.java @@ -6,7 +6,7 @@ import java.lang.annotation.*; *

标记为搜索字段

* * @author Hamm.cn - * @apiNote 默认为 LIKE,支持 LIKE, JOIN, EQUALS + * @apiNote 默认为 {@code LIKE},支持 {@code LIKE}, {@code JOIN}, {@code EQUALS} */ @Target({ElementType.METHOD, ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) @@ -32,7 +32,7 @@ public @interface Search { LIKE, /** - *

JOIN 查询

+ *

{@code JOIN} 查询

*/ JOIN, } diff --git a/airpower-core/src/main/java/cn/hamm/airpower/auto/RedisConfigurer.java b/airpower-core/src/main/java/cn/hamm/airpower/auto/RedisConfigurer.java index 85fe7e7..647e6f7 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/auto/RedisConfigurer.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/auto/RedisConfigurer.java @@ -20,7 +20,7 @@ import java.time.Duration; import java.util.Objects; /** - *

Redis 配置

+ *

{@code Redis} 配置

* * @author Hamm.cn */ @@ -28,7 +28,7 @@ import java.util.Objects; @EnableCaching public class RedisConfigurer implements CachingConfigurer { /** - *

Redis 连接工厂

+ *

{@code Redis} 连接工厂

*/ @Resource private RedisConnectionFactory redisConnectionFactory; diff --git a/airpower-core/src/main/java/cn/hamm/airpower/config/Configs.java b/airpower-core/src/main/java/cn/hamm/airpower/config/Configs.java index 15082b7..4279f1f 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/config/Configs.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/config/Configs.java @@ -5,14 +5,14 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; /** - *

AirPower 配置

+ *

{@code AirPower} 配置

* * @author Hamm.cn */ @Component public class Configs { /** - *

全局 Cookie 配置

+ *

全局 {@code Cookie} 配置

*/ @Getter private static CookieConfig cookieConfig; @@ -24,13 +24,13 @@ public class Configs { private static ServiceConfig serviceConfig; /** - *

MQTT 配置

+ *

{@code MQTT} 配置

*/ @Getter private static MqttConfig mqttConfig; /** - *

WebSocket 配置

+ *

{@code WebSocket} 配置

*/ @Getter private static WebSocketConfig websocketConfig; diff --git a/airpower-core/src/main/java/cn/hamm/airpower/config/Constant.java b/airpower-core/src/main/java/cn/hamm/airpower/config/Constant.java index 5090f56..2ad02e9 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/config/Constant.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/config/Constant.java @@ -9,37 +9,37 @@ import org.springframework.http.HttpStatus; */ public class Constant { /** - *

AirPower

+ *

{@code AirPower}

*/ public static final String AIRPOWER = "airpower"; /** - *

创建时间字段名 createTime

+ *

创建时间字段名 {@code createTime}

*/ public static final String CREATE_TIME_FIELD = "createTime"; /** - *

修改时间字段名 updateTime

+ *

修改时间字段名 {@code updateTime}

*/ public static final String UPDATE_TIME_FIELD = "updateTime"; /** - *

主键 ID 字段名

+ *

主键 {@code ID} 字段名

*/ public static final String ID = "id"; /** - *

一分钟 60

+ *

一分钟 {@code 60}

*/ public static final int SECOND_PER_MINUTE = 60; /** - *

一天 24 小时

+ *

一天 {@code 24} 小时

*/ public static final int HOUR_PER_DAY = 24; /** - *

一周 7

+ *

一周 {@code 7} 天

*/ public static final int DAY_PER_WEEK = 7; @@ -54,62 +54,62 @@ public class Constant { public static final int SECOND_PER_DAY = SECOND_PER_HOUR * HOUR_PER_DAY; /** - *

本机 IP 地址

+ *

本机 {@code IP} 地址

*/ public static final String LOCAL_IP_ADDRESS = "127.0.0.1"; /** - *

空字符串

+ *

空字符串 {@code }

*/ public static final String EMPTY_STRING = ""; /** - *

下划线 _

+ *

下划线 {@code _}

*/ public final static String UNDERLINE = "_"; /** - *

半角空格

+ *

半角空格 {@code }

*/ public final static String SPACE = " "; /** - *

半角逗号 ,

+ *

半角逗号 {@code ,}

*/ public final static String COMMA = ","; /** - *

半角冒号 :

+ *

半角冒号 {@code :}

*/ public final static String COLON = ":"; /** - *

分号 ;

+ *

分号 {@code ;}

*/ public final static String SEMICOLON = ";"; /** - *

竖线 |

+ *

竖线 {@code |}

*/ public final static String VERTICAL_LINE = "|"; /** - *

斜线 /

+ *

斜线 {@code /}

*/ public final static String SLASH = "/"; /** - *

横线 -

+ *

横线 {@code -}

*/ public final static String LINE = "-"; /** - *

等号 =

+ *

等号 {@code =}

*/ public final static String EQUAL = "="; /** - *

.

+ *

点 {@code .}

*/ public final static String DOT = "."; @@ -119,117 +119,117 @@ public class Constant { public static final String DOT_REGEX = "\\."; /** - *

星号 *

+ *

星号 {@code *}

*/ public final static String ASTERISK = "*"; /** - *

百分号 %

+ *

百分号 {@code %}

*/ public static final String PERCENT = "%"; /** - *

控制器后缀 Controller

+ *

控制器后缀 {@code Controller}

*/ public static final String CONTROLLER_SUFFIX = "Controller"; /** - *

get

+ *

{@code get}

*/ public static final String GET = "get"; /** - *

Key

+ *

{@code Key}

*/ public static final String KEY = "key"; /** - *

Label

+ *

{@code Label}

*/ public static final String LABEL = "label"; /** - *

Error

+ *

{@code Error}

*/ public static final String ERROR = "error"; /** - *

Name

+ *

{@code Name}

*/ public static final String NAME = "name"; /** - *

Code

+ *

{@code Code}

*/ public static final String CODE = "code"; /** - *

Message

+ *

{@code Message}

*/ public static final String MESSAGE = "message"; /** - *

Success

+ *

{@code Success}

*/ public static final String SUCCESS = "success"; /** - *

Value

+ *

{@code Value}

*/ public static final String VALUE = "value"; /** - *

Double 0D

+ *

Double {@code 0D}

*/ public static final double ZERO_DOUBLE = 0D; /** - *

Long 0L

+ *

Long {@code 0L}

*/ public static final long ZERO_LONG = 0L; /** - *

Int 0

+ *

Int {@code 0}

*/ public static final int ZERO_INT = 0; /** - *

String "0"

+ *

String {@code "0"}

*/ public static final String ZERO_STRING = "0"; /** - *

String "1"

+ *

String {@code "1"}

*/ public static final String ONE_STRING = "1"; /** - *

String "true"

+ *

String {@code "true"}

*/ public static final String TRUE_STRING = "true"; /** - *

String "false"

+ *

String {@code "false"}

*/ public static final String FALSE_STRING = "false"; /** - *

JSON 成功状态码

+ *

{@code JSON} 成功状态码

*/ public static final int JSON_SUCCESS_CODE = HttpStatus.OK.value(); /** - *

JSON 成功信息

+ *

{@code JSON} 成功信息

*/ public static final String JSON_SUCCESS_MESSAGE = "操作成功"; /** - *

ContentType

+ *

{@code ContentType}

*/ public static final String CONTENT_TYPE = "Content-Type"; /** - *

Cookie

+ *

{@code Cookie}

*/ public static final String COOKIE = "Cookie"; @@ -244,17 +244,17 @@ public class Constant { public static final String LINE_BREAK = "\n"; /** - *

TAB

+ *

{@code TAB}

*/ public static final String TAB = "\t"; /** - *

"是"

+ *

{@code "是"}

*/ public static final String YES = "是"; /** - *

"否"

+ *

{@code "否"}

*/ public static final String NO = "否"; } diff --git a/airpower-core/src/main/java/cn/hamm/airpower/config/CookieConfig.java b/airpower-core/src/main/java/cn/hamm/airpower/config/CookieConfig.java index ab7c9f7..8541a55 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/config/CookieConfig.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/config/CookieConfig.java @@ -8,7 +8,7 @@ import org.springframework.context.annotation.Configuration; import org.springframework.stereotype.Component; /** - *

Cookie 相关配置

+ *

{@code Cookie} 相关配置

* * @author Hamm.cn * @see CookieUtil @@ -20,27 +20,27 @@ import org.springframework.stereotype.Component; @ConfigurationProperties("airpower.cookie") public class CookieConfig { /** - *

Cookie 的路径

+ *

{@code Cookie} 的路径

*/ private String cookiePath = Constant.SLASH; /** - *

身份验证的 Cookie 名称

+ *

身份验证的 {@code Cookie} 名称

*/ private String authCookieName = "authorization-key"; /** - *

CookieHttpOnly 配置

+ *

{@code Cookie} 的 {@code HttpOnly} 配置

*/ private boolean cookieHttpOnly = true; /** - *

Cookie 有效期

+ *

{@code Cookie} 有效期

*/ private int cookieMaxAge = Constant.SECOND_PER_DAY; /** - *

使用 Https 方式的安全 Cookie

+ *

使用 {@code Https} 方式的安全 {@code Cookie}

*/ private boolean cookieSecurity = true; } diff --git a/airpower-core/src/main/java/cn/hamm/airpower/config/MqttConfig.java b/airpower-core/src/main/java/cn/hamm/airpower/config/MqttConfig.java index 99ff655..e58db83 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/config/MqttConfig.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/config/MqttConfig.java @@ -7,7 +7,7 @@ import org.springframework.context.annotation.Configuration; import org.springframework.stereotype.Component; /** - *

MQTT 配置类

+ *

{@code MQTT} 配置类

* * @author Hamm.cn */ diff --git a/airpower-core/src/main/java/cn/hamm/airpower/config/ServiceConfig.java b/airpower-core/src/main/java/cn/hamm/airpower/config/ServiceConfig.java index fd2d704..674e7cf 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/config/ServiceConfig.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/config/ServiceConfig.java @@ -24,7 +24,7 @@ public class ServiceConfig { private String databasePrefix = "tenant_"; /** - *

默认服务 ID

+ *

默认服务 {@code ID}

*/ private int serviceId = Constant.ZERO_INT; @@ -34,7 +34,7 @@ public class ServiceConfig { private boolean enableDocument = false; /** - *

AccessToken 的密钥

+ *

{@code AccessToken} 的密钥

*/ private String accessTokenSecret = Constant.AIRPOWER; @@ -69,7 +69,7 @@ public class ServiceConfig { private String defaultSortDirection = "desc"; /** - *

身份令牌 headerkey

+ *

身份令牌 {@code header} 的 {@code key}

*/ private String authorizeHeader = HttpHeaders.AUTHORIZATION; @@ -79,14 +79,14 @@ public class ServiceConfig { private long authorizeExpireSecond = Constant.SECOND_PER_DAY; /** - *

多租户的 headerkey

+ *

多租户的 {@code header} 的 {@code key}

*/ private String tenantHeader = "tenant-code"; /** *

导出文件的目录

* - * @apiNote 请不要使用 / 结尾 + * @apiNote 请{@code 不要}使用 {@code /} 结尾 */ private String exportFilePath = ""; @@ -98,12 +98,12 @@ public class ServiceConfig { private boolean debug = true; /** - *

MQTT 配置

+ *

{@code MQTT} 配置

*/ private MqttConfig mqtt = new MqttConfig(); /** - *

Cookie 配置

+ *

{@code Cookie} 配置

*/ private CookieConfig cookie = new CookieConfig(); } diff --git a/airpower-core/src/main/java/cn/hamm/airpower/config/WebSocketConfig.java b/airpower-core/src/main/java/cn/hamm/airpower/config/WebSocketConfig.java index 9bc65b9..9dab1e4 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/config/WebSocketConfig.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/config/WebSocketConfig.java @@ -8,7 +8,7 @@ import org.springframework.context.annotation.Configuration; import org.springframework.stereotype.Component; /** - *

WebSocket 配置

+ *

{@code WebSocket} 配置

* * @author Hamm */ @@ -19,22 +19,22 @@ import org.springframework.stereotype.Component; @ConfigurationProperties("airpower.websocket") public class WebSocketConfig { /** - *

PING

+ *

{@code PING}

*/ private String ping = "PING"; /** - *

PONG

+ *

{@code PONG}

*/ private String pong = "PONG"; /** - *

WebSocket 路径

+ *

{@code WebSocket} 路径

*/ private String path = "/websocket"; /** - *

WebSocket 支持方式

+ *

{@code WebSocket} 支持方式

*/ private WebSocketSupport support = WebSocketSupport.NO; @@ -44,7 +44,7 @@ public class WebSocketConfig { private String channelPrefix; /** - *

WebSocket 允许的跨域

+ *

{@code WebSocket} 允许的跨域

*/ private String allowedOrigins = "*"; } diff --git a/airpower-core/src/main/java/cn/hamm/airpower/enums/ContentType.java b/airpower-core/src/main/java/cn/hamm/airpower/enums/ContentType.java index 31115ce..b40092b 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/enums/ContentType.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/enums/ContentType.java @@ -13,32 +13,32 @@ import org.springframework.http.MediaType; @AllArgsConstructor public enum ContentType { /** - *

JSON

+ *

{@code JSON}

*/ JSON(MediaType.APPLICATION_JSON_VALUE), /** - *

HTML

+ *

{@code HTML}

*/ HTML(MediaType.TEXT_HTML_VALUE), /** - *

PLAIN

+ *

{@code PLAIN}

*/ PLAIN(MediaType.TEXT_PLAIN_VALUE), /** - *

XML

+ *

{@code XML}

*/ XML(MediaType.TEXT_XML_VALUE), /** - *

FORM_URLENCODED

+ *

{@code FORM_URLENCODED}

*/ FORM_URLENCODED(MediaType.APPLICATION_FORM_URLENCODED_VALUE), /** - *

MULTIPART_FORM_DATA

+ *

{@code MULTIPART_FORM_DATA}

*/ MULTIPART_FORM_DATA(MediaType.MULTIPART_FORM_DATA_VALUE); diff --git a/airpower-core/src/main/java/cn/hamm/airpower/enums/HttpMethod.java b/airpower-core/src/main/java/cn/hamm/airpower/enums/HttpMethod.java index 6c6b0cb..8afe6f8 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/enums/HttpMethod.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/enums/HttpMethod.java @@ -1,28 +1,28 @@ package cn.hamm.airpower.enums; /** - *

HTTP 请求方式

+ *

{@code HTTP} 请求方式

* * @author Hamm.cn */ public enum HttpMethod { /** - *

GET

+ *

{@code GET}

*/ GET, /** - *

POST

+ *

{@code POST}

*/ POST, /** - *

PUT

+ *

{@code PUT}

*/ PUT, /** - *

DELETE

+ *

{@code DELETE}

*/ DELETE, } diff --git a/airpower-core/src/main/java/cn/hamm/airpower/interceptor/AbstractRequestInterceptor.java b/airpower-core/src/main/java/cn/hamm/airpower/interceptor/AbstractRequestInterceptor.java index 101d0c1..16250cd 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/interceptor/AbstractRequestInterceptor.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/interceptor/AbstractRequestInterceptor.java @@ -37,7 +37,7 @@ import java.util.Objects; @Slf4j public abstract class AbstractRequestInterceptor implements HandlerInterceptor { /** - *

缓存的 REQUEST_METHOD_KEY

+ *

缓存的 {@code REQUEST_METHOD_KEY}

*/ protected static final String REQUEST_METHOD_KEY = "REQUEST_METHOD_KEY"; @@ -112,7 +112,7 @@ public abstract class AbstractRequestInterceptor implements HandlerInterceptor { /** *

验证指定的用户是否有指定权限标识的权限

* - * @param userId 用户 ID + * @param userId 用户 {@code ID} * @param permissionIdentity 权限标识 * @param request 请求对象 * @apiNote 抛出异常则为拦截 diff --git a/airpower-core/src/main/java/cn/hamm/airpower/interceptor/ExceptionInterceptor.java b/airpower-core/src/main/java/cn/hamm/airpower/interceptor/ExceptionInterceptor.java index 95072ea..3e2dbc0 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/interceptor/ExceptionInterceptor.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/interceptor/ExceptionInterceptor.java @@ -115,7 +115,7 @@ public class ExceptionInterceptor { } /** - *

请求的数据不是标准 JSON

+ *

请求的数据不是标准 {@code JSON}

*/ @ExceptionHandler(HttpMessageNotReadableException.class) public Json dataExceptionHandle(@NotNull HttpMessageNotReadableException exception) { @@ -163,7 +163,7 @@ public class ExceptionInterceptor { } /** - *

Redis 连接发生错误

+ *

{@code Redis} 连接发生错误

*/ @ExceptionHandler(RedisConnectionFailureException.class) public Json redisExceptionHandle(@NotNull RedisConnectionFailureException exception) { diff --git a/airpower-core/src/main/java/cn/hamm/airpower/interceptor/ResponseBodyInterceptor.java b/airpower-core/src/main/java/cn/hamm/airpower/interceptor/ResponseBodyInterceptor.java index 3cb0466..1536393 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/interceptor/ResponseBodyInterceptor.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/interceptor/ResponseBodyInterceptor.java @@ -132,7 +132,7 @@ public class ResponseBodyInterceptor implements ResponseBodyAdvice { * * @param body 响应体 * @return 响应体 - * @apiNote 如无其他操作,请直接返回body参数即可 + * @apiNote 如无其他操作,请直接返回{@code body}参数即可 */ @SuppressWarnings("unused") protected Object beforeResponseFinished(Object body, ServerHttpRequest request, ServerHttpResponse response) { diff --git a/airpower-core/src/main/java/cn/hamm/airpower/interfaces/IDictionary.java b/airpower-core/src/main/java/cn/hamm/airpower/interfaces/IDictionary.java index 935710a..5637fe4 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/interfaces/IDictionary.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/interfaces/IDictionary.java @@ -10,9 +10,9 @@ import cn.hamm.airpower.util.ReflectUtil; */ public interface IDictionary { /** - *

获取枚举的 Key

+ *

获取枚举的 {@code Key}

* - * @return Key + * @return {@code Key} */ int getKey(); @@ -24,9 +24,9 @@ public interface IDictionary { String getLabel(); /** - *

判断 Key 是否相等

+ *

判断 {@code Key} 是否相等

* - * @param key 被判断的 Key + * @param key 被判断的 {@code Key} * @return 对比结果 */ default boolean equalsKey(int key) { @@ -34,9 +34,9 @@ public interface IDictionary { } /** - *

判断 Key 是否不相等

+ *

判断 {@code Key} 是否不相等

* - * @param key 被判断的 Key + * @param key 被判断的 {@code Key} * @return 对比结果 */ default boolean notEqualsKey(int key) { diff --git a/airpower-core/src/main/java/cn/hamm/airpower/interfaces/IEntity.java b/airpower-core/src/main/java/cn/hamm/airpower/interfaces/IEntity.java index 8fd4525..189e974 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/interfaces/IEntity.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/interfaces/IEntity.java @@ -7,16 +7,16 @@ package cn.hamm.airpower.interfaces; */ public interface IEntity> { /** - *

获取主键 ID

+ *

获取主键 {@code ID}

* - * @return 主键 ID + * @return 主键 {@code ID} */ Long getId(); /** - *

设置实体主键 ID

+ *

设置实体主键 {@code ID}

* - * @param id 主键 ID + * @param id 主键 {@code ID} * @return 实体 */ E setId(Long id); diff --git a/airpower-core/src/main/java/cn/hamm/airpower/interfaces/IEntityAction.java b/airpower-core/src/main/java/cn/hamm/airpower/interfaces/IEntityAction.java index f7fb1dc..38926c5 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/interfaces/IEntityAction.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/interfaces/IEntityAction.java @@ -7,7 +7,7 @@ package cn.hamm.airpower.interfaces; */ public interface IEntityAction extends IAction { /** - *

ID 必须传入的场景

+ *

{@code ID} 必须传入的场景

*/ interface WhenIdRequired { } diff --git a/airpower-core/src/main/java/cn/hamm/airpower/interfaces/IFile.java b/airpower-core/src/main/java/cn/hamm/airpower/interfaces/IFile.java index 1bcd5bb..d19b895 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/interfaces/IFile.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/interfaces/IFile.java @@ -7,16 +7,16 @@ package cn.hamm.airpower.interfaces; */ public interface IFile> extends IEntity { /** - *

获取文件的 URL

+ *

获取文件的 {@code URL}

* - * @return URL + * @return {@code URL} */ String getUrl(); /** - *

设置文件的 URL

+ *

设置文件的 {@code URL}

* - * @param url URL + * @param url {@code URL} * @return 实体 */ E setUrl(String url); diff --git a/airpower-core/src/main/java/cn/hamm/airpower/interfaces/IFunction.java b/airpower-core/src/main/java/cn/hamm/airpower/interfaces/IFunction.java index c717d69..0fca88d 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/interfaces/IFunction.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/interfaces/IFunction.java @@ -4,7 +4,7 @@ import java.io.Serializable; import java.util.function.Function; /** - *

带序列化的 Function

+ *

带序列化的 {@code Function}

* * @author Hamm.cn */ diff --git a/airpower-core/src/main/java/cn/hamm/airpower/interfaces/ITree.java b/airpower-core/src/main/java/cn/hamm/airpower/interfaces/ITree.java index 2bae5c9..ab3bac0 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/interfaces/ITree.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/interfaces/ITree.java @@ -24,16 +24,16 @@ public interface ITree> extends IEntity { E setName(String name); /** - *

获取树的父级 ID

+ *

获取树的父级 {@code ID}

* - * @return 父级 ID + * @return 父级 {@code ID} */ Long getParentId(); /** - *

设置父级 ID

+ *

设置父级 {@code ID}

* - * @param parentId 设置父级 ID + * @param parentId 设置父级 {@code ID} * @return 树实体 */ E setParentId(Long parentId); diff --git a/airpower-core/src/main/java/cn/hamm/airpower/model/Json.java b/airpower-core/src/main/java/cn/hamm/airpower/model/Json.java index 02c7c22..d6c9af0 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/model/Json.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/model/Json.java @@ -24,7 +24,7 @@ import java.util.Map; import java.util.Objects; /** - *

简单 JSON 对象

+ *

简单 {@code JSON} 对象

* * @author Hamm.cn */ @@ -33,7 +33,7 @@ import java.util.Objects; @Slf4j public class Json { /** - *

ObjectMapper

+ *

{@code ObjectMapper}

*/ private static ObjectMapper objectMapper = null; @@ -64,7 +64,7 @@ public class Json { *

输出提示信息

* * @param message 提示信息 - * @return Json + * @return {@code Json} */ public static Json success(String message) { return create().setMessage(message); @@ -74,7 +74,7 @@ public class Json { *

输出数据

* * @param data 数据 - * @return Json + * @return {@code Json} */ public static Json data(Object data) { return data(data, "获取成功"); @@ -83,9 +83,9 @@ public class Json { /** *

输出实体

* - * @param id 实体 ID + * @param id 实体 {@code ID} * @param 实体类型 - * @return Json + * @return {@code Json} */ public static > Json entity(@NotNull Long id) { return data(new RootEntity().setId(id)); @@ -94,9 +94,9 @@ public class Json { /** *

输出实体

* - * @param id 实体 Json + * @param id 实体 {@code Json} * @param message 提示信息 - * @return Json + * @return {@code Json} */ public static Json entity(@NotNull Long id, @NotNull String message) { return entity(id).setMessage(message); @@ -107,7 +107,7 @@ public class Json { * * @param data 数据 * @param message 提示信息 - * @return Json + * @return {@code Json} */ public static Json data(Object data, String message) { return create().setData(data).setMessage(message); @@ -117,7 +117,7 @@ public class Json { *

输出错误

* * @param error 错误枚举 - * @return Json + * @return {@code Json} */ public static Json error(IException error) { return error(error, error.getMessage()); @@ -128,7 +128,7 @@ public class Json { * * @param error 错误枚举 * @param message 错误信息 - * @return Json + * @return {@code Json} */ public static Json error(@NotNull IException error, String message) { return show(error.getCode(), message, null); @@ -138,26 +138,26 @@ public class Json { *

输出错误

* * @param message 错误信息 - * @return Json + * @return {@code Json} */ public static Json error(String message) { return error(ServiceError.SERVICE_ERROR, message); } /** - *

输出 Json

+ *

输出 {@code Json}

* * @param code 错误代码 * @param message 提示信息 * @param data 输出数据 - * @return Json + * @return {@code Json} */ public static Json show(int code, String message, Object data) { return create().setCode(code).setMessage(message).setData(data); } /** - *

Json 反序列化到指定类

+ *

{@code Json} 反序列化到指定类

* * @param json 字符串 * @param clazz 目标类 @@ -174,10 +174,10 @@ public class Json { } /** - *

Json 反序列化为 Map

+ *

{@code Json} 反序列化为 {@code Map}

* * @param json 字符串 - * @return Map + * @return {@code Map} */ public static Map parse2Map(String json) { try { @@ -191,10 +191,10 @@ public class Json { } /** - *

Json 反序列化为 ListMap

+ *

{@code Json} 反序列化为 {@code ListMap}

* * @param json 字符串 - * @return List + * @return {@code List} */ public static List> parse2MapList(String json) { try { @@ -208,7 +208,7 @@ public class Json { } /** - *

Json 序列化到字符串

+ *

{@code Json} 序列化到字符串

* * @param object 对象 * @return 字符串 @@ -223,9 +223,9 @@ public class Json { } /** - *

获取一个配置后的 ObjectMapper

+ *

获取一个配置后的 {@code ObjectMapper}

* - * @return ObjectMapper + * @return {@code ObjectMapper} */ private static @NotNull ObjectMapper getObjectMapper() { if (Objects.isNull(objectMapper)) { @@ -241,9 +241,9 @@ public class Json { } /** - *

初始化一个新的 JSON 对象

+ *

初始化一个新的 {@code JSON} 对象

* - * @return JSON 对象 + * @return {@code JSON} 对象 */ @Contract(" -> new") public static @NotNull Json create() { diff --git a/airpower-core/src/main/java/cn/hamm/airpower/open/IOpenApp.java b/airpower-core/src/main/java/cn/hamm/airpower/open/IOpenApp.java index fe89cd0..9962044 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/open/IOpenApp.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/open/IOpenApp.java @@ -8,16 +8,16 @@ package cn.hamm.airpower.open; */ public interface IOpenApp { /** - *

获取应用的 AppKey

+ *

获取应用的 {@code AppKey}

* - * @return AppKey + * @return {@code AppKey} */ String getAppKey(); /** - *

获取应用的 AppSecret

+ *

获取应用的 {@code AppSecret}

* - * @return AppSecret + * @return {@code AppSecret} */ String getAppSecret(); diff --git a/airpower-core/src/main/java/cn/hamm/airpower/open/IOpenAppService.java b/airpower-core/src/main/java/cn/hamm/airpower/open/IOpenAppService.java index 5b7b336..a0b8e23 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/open/IOpenAppService.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/open/IOpenAppService.java @@ -1,16 +1,16 @@ package cn.hamm.airpower.open; /** - *

开放应用的 Service 接口

+ *

开放应用的 {@code Service} 接口

* * @author Hamm.cn * @apiNote 请确保你的开放应用的Service实现了此接口 */ public interface IOpenAppService { /** - *

通过应用的 AppKey 查一个应用

+ *

通过应用的 {@code AppKey} 查一个应用

* - * @param appKey AppKey + * @param appKey {@code AppKey} * @return 应用 */ IOpenApp getByAppKey(String appKey); diff --git a/airpower-core/src/main/java/cn/hamm/airpower/open/IOpenLogService.java b/airpower-core/src/main/java/cn/hamm/airpower/open/IOpenLogService.java index 8a42c1c..b88e3b5 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/open/IOpenLogService.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/open/IOpenLogService.java @@ -4,7 +4,7 @@ package cn.hamm.airpower.open; *

开放应用请求日志接口

* * @author Hamm.cn - * @apiNote 请确保你的应用请求日志 Service 实现了此接口,否则将无法记录请求日志 + * @apiNote 请确保你的应用请求日志 {@code Service} 实现了此接口,否则将无法记录请求日志 */ public interface IOpenLogService { /** @@ -20,7 +20,7 @@ public interface IOpenLogService { /** *

更新请求日志

* - * @param openLogId 请求日志 ID + * @param openLogId 请求日志 {@code ID} * @param responseBody 响应体 */ void updateResponse(Long openLogId, String responseBody); diff --git a/airpower-core/src/main/java/cn/hamm/airpower/open/OpenApi.java b/airpower-core/src/main/java/cn/hamm/airpower/open/OpenApi.java index 1e89336..1d8ef42 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/open/OpenApi.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/open/OpenApi.java @@ -3,7 +3,7 @@ package cn.hamm.airpower.open; import java.lang.annotation.*; /** - *

OpenApi

+ *

{@code OpenApi}

* * @author Hamm.cn */ diff --git a/airpower-core/src/main/java/cn/hamm/airpower/open/OpenApiAspect.java b/airpower-core/src/main/java/cn/hamm/airpower/open/OpenApiAspect.java index de1ead9..2659984 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/open/OpenApiAspect.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/open/OpenApiAspect.java @@ -20,7 +20,7 @@ import java.lang.reflect.Method; import java.util.Objects; /** - *

OpenApi 切面

+ *

{@code OpenApi} 切面

* * @author Hamm.cn */ @@ -40,7 +40,7 @@ public class OpenApiAspectOpenApi + *

{@code OpenApi}

*/ @Around("pointCut()") public Object openApi(@NotNull ProceedingJoinPoint proceedingJoinPoint) throws Throwable { @@ -84,10 +84,10 @@ public class OpenApiAspect从请求对象中获取 OpenApp + *

从请求对象中获取 {@code OpenApp}

* - * @param openRequest OpenRequest - * @return OpenApp + * @param openRequest {@code OpenRequest} + * @return {@code OpenApp} */ private @NotNull IOpenApp getOpenAppFromRequest(@NotNull OpenRequest openRequest) { ServiceError.INVALID_APP_KEY.when(!StringUtils.hasText(openRequest.getAppKey())); @@ -100,8 +100,8 @@ public class OpenApiAspect添加日志 * - * @param openApp OpenApp - * @param url 请求 URL + * @param openApp {@code OpenApp} + * @param url 请求 {@code URL} * @param requestBody 请求数据 * @return 日志ID */ @@ -115,7 +115,7 @@ public class OpenApiAspect更新日志返回数据 * - * @param openLogId 日志 ID + * @param openLogId 日志 {@code ID} * @param responseBody 返回值 */ private void updateLogResponse(Long openLogId, String responseBody) { @@ -128,7 +128,7 @@ public class OpenApiAspect更新日志异常 * - * @param openLogId 日志 ID + * @param openLogId 日志 {@code ID} * @param exception 异常 */ private void updateExceptionResponse(Long openLogId, Exception exception) { diff --git a/airpower-core/src/main/java/cn/hamm/airpower/open/OpenArithmeticType.java b/airpower-core/src/main/java/cn/hamm/airpower/open/OpenArithmeticType.java index 7a29173..f5a6fac 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/open/OpenArithmeticType.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/open/OpenArithmeticType.java @@ -13,12 +13,12 @@ import lombok.Getter; @Getter public enum OpenArithmeticType implements IDictionary { /** - *

AES 算法

+ *

{@code AES} 算法

*/ AES(1, "AES"), /** - *

RSA 算法

+ *

{@code RSA} 算法

*/ RSA(2, "RSA"), diff --git a/airpower-core/src/main/java/cn/hamm/airpower/open/OpenBaseModel.java b/airpower-core/src/main/java/cn/hamm/airpower/open/OpenBaseModel.java index fcec188..2aa7098 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/open/OpenBaseModel.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/open/OpenBaseModel.java @@ -3,7 +3,7 @@ package cn.hamm.airpower.open; import cn.hamm.airpower.root.RootModel; /** - *

OpenApi 数据模型基类

+ *

{@code OpenApi} 数据模型基类

* * @author Hamm.cn */ diff --git a/airpower-core/src/main/java/cn/hamm/airpower/open/OpenRequest.java b/airpower-core/src/main/java/cn/hamm/airpower/open/OpenRequest.java index 532c73e..81ec256 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/open/OpenRequest.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/open/OpenRequest.java @@ -14,7 +14,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.codec.digest.DigestUtils; /** - *

OpenApi 请求体

+ *

{@code OpenApi} 请求体

* * @author Hamm.cn */ @@ -32,7 +32,7 @@ public class OpenRequest { private static final int NONCE_CACHE_SECOND = 60; /** - *

AppKey

+ *

{@code AppKey}

*/ @NotBlank(message = "AppKey不能为空") @Getter diff --git a/airpower-core/src/main/java/cn/hamm/airpower/open/OpenResponse.java b/airpower-core/src/main/java/cn/hamm/airpower/open/OpenResponse.java index b4dc169..30ee5d9 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/open/OpenResponse.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/open/OpenResponse.java @@ -8,7 +8,7 @@ import cn.hamm.airpower.util.Utils; import java.util.Objects; /** - *

OpenApi 响应对象

+ *

{@code OpenApi} 响应对象

* * @author Hamm.cn */ diff --git a/airpower-core/src/main/java/cn/hamm/airpower/resolver/AccessResolver.java b/airpower-core/src/main/java/cn/hamm/airpower/resolver/AccessResolver.java index 6945519..26a3a7a 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/resolver/AccessResolver.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/resolver/AccessResolver.java @@ -34,7 +34,7 @@ public class AccessResolver implements HandlerMethodArgumentResolver { } /** - *

ACCESS_TOKEN 换用户 ID

+ *

{@code ACCESS_TOKEN} 换用户 {@code ID}

*/ @Override public final @NotNull @Unmodifiable Object resolveArgument( diff --git a/airpower-core/src/main/java/cn/hamm/airpower/root/RootController.java b/airpower-core/src/main/java/cn/hamm/airpower/root/RootController.java index f1f6258..1cc4127 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/root/RootController.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/root/RootController.java @@ -23,7 +23,7 @@ public class RootController implements IAction { /** *

获取当前登录用户的信息

* - * @return 用户 ID + * @return 用户 {@code ID} */ protected final long getCurrentUserId() { try { diff --git a/airpower-core/src/main/java/cn/hamm/airpower/root/RootEntity.java b/airpower-core/src/main/java/cn/hamm/airpower/root/RootEntity.java index e128b60..3bfd30f 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/root/RootEntity.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/root/RootEntity.java @@ -114,9 +114,9 @@ public class RootEntity> extends RootModel private Long updateTimeTo; /** - *

设置 ID

+ *

设置 {@code ID}

* - * @param id ID + * @param id {@code ID} * @return 实体 */ @Override @@ -159,9 +159,9 @@ public class RootEntity> extends RootModel } /** - *

设置创建人 ID

+ *

设置创建人 {@code ID}

* - * @param createUserId 创建人 ID + * @param createUserId 创建人 {@code ID} * @return 实体 */ public E setCreateUserId(Long createUserId) { @@ -170,9 +170,9 @@ public class RootEntity> extends RootModel } /** - *

设置修改人 ID

+ *

设置修改人 {@code ID}

* - * @param updateUserId 修改人 ID + * @param updateUserId 修改人 {@code ID} * @return 实体 */ public E setUpdateUserId(Long updateUserId) { @@ -206,9 +206,9 @@ public class RootEntity> extends RootModel } /** - *

复制一个只包含 ID 的实体

+ *

复制一个只包含 {@code ID} 的实体

* - * @return 只复制 ID 的实体 + * @return 只复制 {@code ID} 的实体 */ public final @org.jetbrains.annotations.NotNull E copyOnlyId() { try { diff --git a/airpower-core/src/main/java/cn/hamm/airpower/root/RootEntityController.java b/airpower-core/src/main/java/cn/hamm/airpower/root/RootEntityController.java index 8f20dfb..94723fe 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/root/RootEntityController.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/root/RootEntityController.java @@ -277,7 +277,7 @@ public class RootEntityController< /** *

新增后置方法

* - * @param id 主键 ID + * @param id 主键 {@code ID} * @param source 原始实体 * @apiNote 可重写后执行新增后的其他业务 */ @@ -299,7 +299,7 @@ public class RootEntityController< /** *

修改后置方法

* - * @param id 主键 ID + * @param id 主键 {@code ID} * @param source 原始实体 * @apiNote 可重写后执行修改之后的其他业务 */ @@ -310,7 +310,7 @@ public class RootEntityController< /** *

保存后置方法

* - * @param id 主键 ID + * @param id 主键 {@code ID} * @param source 原始实体 * @apiNote 新增和修改最后触发 */ @@ -321,7 +321,7 @@ public class RootEntityController< /** *

删除前置方法

* - * @param id 主键 ID + * @param id 主键 {@code ID} * @apiNote 可重写后执行删除之前的业务处理或拦截 */ @SuppressWarnings({"unused", "EmptyMethod"}) @@ -331,7 +331,7 @@ public class RootEntityController< /** * 删除后置方法 * - * @param id 主键 ID + * @param id 主键 {@code ID} * @apiNote 可重写后执行删除之后的其他业务 */ @SuppressWarnings({"unused", "EmptyMethod"}) @@ -341,7 +341,7 @@ public class RootEntityController< /** *

禁用前置方法

* - * @param id 主键 ID + * @param id 主键 {@code ID} * @apiNote 可重写后执行禁用之前的业务处理或拦截 */ @SuppressWarnings({"unused", "EmptyMethod"}) @@ -351,7 +351,7 @@ public class RootEntityController< /** *

禁用后置方法

* - * @param id 主键 ID + * @param id 主键 {@code ID} * @apiNote 可重写后执行禁用之后的其他业务 */ @SuppressWarnings({"unused", "EmptyMethod"}) @@ -361,7 +361,7 @@ public class RootEntityController< /** *

启用前置方法

* - * @param id 主键 ID + * @param id 主键 {@code ID} */ @SuppressWarnings({"unused", "EmptyMethod"}) protected void beforeEnable(long id) { @@ -370,7 +370,7 @@ public class RootEntityController< /** *

启用后置方法

* - * @param id 主键 ID + * @param id 主键 {@code ID} */ @SuppressWarnings({"unused", "EmptyMethod"}) protected void afterEnable(long id) { diff --git a/airpower-core/src/main/java/cn/hamm/airpower/root/RootService.java b/airpower-core/src/main/java/cn/hamm/airpower/root/RootService.java index d8f2ee6..d7bc278 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/root/RootService.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/root/RootService.java @@ -131,8 +131,8 @@ public class RootService, R extends RootRepository> { * @apiNote 支持完全重写导出文件生成逻辑 * *
    - *
  • 默认导出为 CSV 表格,如需自定义导出方式或格式,可直接重写此方法
  • - *
  • 如仅需自定义导出存储位置,可重写 {@link #saveExportFile(InputStream)}
  • + *
  • 默认导出为 {@code CSV} 表格,如需自定义导出方式或格式,可直接重写此方法
  • + *
  • 如仅需{@code 自定义导出存储位置},可重写 {@link #saveExportFile(InputStream)}
  • *
*/ protected InputStream createExportStream(List exportList) { @@ -254,7 +254,7 @@ public class RootService, R extends RootRepository> { *

添加一条数据

* * @param source 原始实体 - * @return 保存后的主键 ID + * @return 保存后的主键 {@code ID} * @see #beforeAdd(E) * @see #beforeSaveToDatabase(E) * @see #afterAdd(long, E) @@ -276,7 +276,7 @@ public class RootService, R extends RootRepository> { /** *

添加后置方法

* - * @param id 主键 ID + * @param id 主键 {@code ID} * @param source 原始实体 */ @SuppressWarnings({"unused", "EmptyMethod"}) @@ -310,7 +310,7 @@ public class RootService, R extends RootRepository> { *

修改一条已经存在的数据

* * @param source 保存的实体 - * @apiNote 此方法的 null 属性依然会被更新到数据库 + * @apiNote 此方法的 {@code null} 属性依然会被更新到数据库 * @see #beforeUpdate(E) * @see #afterUpdate(long, E) * @see #afterSaved(long, E) @@ -325,13 +325,13 @@ public class RootService, R extends RootRepository> { *

修改后置方法

* *

- * 请不要在重写此方法后再次调用 {@link #update(E) } 与 {@link #updateWithNull(E)} 以避免循环调用 + * {@code 请不要在重写此方法后再次调用 {@link #update(E) } 与 {@link #updateWithNull(E)} 以避免循环调用} *

*

* 如需再次保存,请调用 {@link #updateToDatabase(E)} *

* - * @param id 主键 ID + * @param id 主键 {@code ID} * @param source 原始实体 */ @SuppressWarnings({"unused", "EmptyMethod"}) @@ -341,7 +341,7 @@ public class RootService, R extends RootRepository> { /** *

保存后置方法

* - * @param id 主键 ID + * @param id 主键 {@code ID} * @param source 保存前的原数据 * @apiNote 添加或修改后最后触发 */ @@ -353,7 +353,7 @@ public class RootService, R extends RootRepository> { /** *

禁用前置方法

* - * @param id 主键 ID + * @param id 主键 {@code ID} */ @SuppressWarnings({"unused", "EmptyMethod"}) protected void beforeDisable(long id) { @@ -362,7 +362,7 @@ public class RootService, R extends RootRepository> { /** *

禁用指定的数据

* - * @param id 主键 ID + * @param id 主键 {@code ID} * @see #beforeDisable(long) * @see #afterDisable(long) */ @@ -375,7 +375,7 @@ public class RootService, R extends RootRepository> { /** *

禁用后置方法

* - * @param id 主键 ID + * @param id 主键 {@code ID} */ @SuppressWarnings({"unused", "EmptyMethod"}) protected void afterDisable(long id) { @@ -384,7 +384,7 @@ public class RootService, R extends RootRepository> { /** *

启用前置方法

* - * @param id 主键 ID + * @param id 主键 {@code ID} */ @SuppressWarnings({"unused", "EmptyMethod"}) protected void beforeEnable(long id) { @@ -393,7 +393,7 @@ public class RootService, R extends RootRepository> { /** *

启用指定的数据

* - * @param id 主键 ID + * @param id 主键 {@code ID} * @see #beforeEnable(long) * @see #afterEnable(long) */ @@ -406,7 +406,7 @@ public class RootService, R extends RootRepository> { /** *

启用后置方法

* - * @param id 主键 ID + * @param id 主键 {@code ID} */ @SuppressWarnings({"unused", "EmptyMethod"}) protected void afterEnable(long id) { @@ -415,7 +415,7 @@ public class RootService, R extends RootRepository> { /** *

删除前置方法

* - * @param id 主键 ID + * @param id 主键 {@code ID} */ @SuppressWarnings({"unused", "EmptyMethod"}) protected void beforeDelete(long id) { @@ -424,7 +424,7 @@ public class RootService, R extends RootRepository> { /** *

删除指定的数据

* - * @param id 主键 ID + * @param id 主键 {@code ID} * @see #beforeDelete(long) * @see #afterDelete(long) */ @@ -437,7 +437,7 @@ public class RootService, R extends RootRepository> { /** *

删除后置方法

* - * @param id 主键 ID + * @param id 主键 {@code ID} */ @SuppressWarnings({"unused", "EmptyMethod"}) protected void afterDelete(long id) { @@ -538,7 +538,7 @@ public class RootService, R extends RootRepository> { } /** - *

数据库操作前的最后一次确认

+ *

数据库操作前的{@code 最后一次}确认

* * @return 当前实体 */ @@ -564,9 +564,9 @@ public class RootService, R extends RootRepository> { } /** - *

根据ID查询对应的实体

+ *

根据{@code ID}查询对应的实体

* - * @param id 主键 ID + * @param id 主键 {@code ID} * @return 实体 * @see #getMaybeNull(long) * @see #getWithEnable(long) @@ -576,9 +576,9 @@ public class RootService, R extends RootRepository> { } /** - *

根据ID查询正常启用的实体

+ *

根据{@code ID}查询正常启用的实体

* - * @param id 主键 ID + * @param id 主键 {@code ID} * @return 实体 * @see #get(long) * @see #getMaybeNull(long) @@ -594,11 +594,11 @@ public class RootService, R extends RootRepository> { } /** - *

根据ID查询对应的实体(可能为null)

+ *

根据{@code ID}查询对应的实体(可能为{@code null})

* - * @param id 主键 ID + * @param id 主键 {@code ID} * @return 实体 - * @apiNote 查不到返回 null,不抛异常 + * @apiNote 查不到返回 {@code null},不抛异常 * @see #get(long) */ public final @Nullable E getMaybeNull(long id) { @@ -618,7 +618,7 @@ public class RootService, R extends RootRepository> { /** *

分页查询数据

* - * @param queryPageRequest 请求的 request 对象 + * @param queryPageRequest 请求的 {@code request} 对象 * @return 分页查询列表 * @see #beforeGetPage(QueryPageRequest) * @see #afterGetPage(QueryPageResponse) @@ -637,7 +637,7 @@ public class RootService, R extends RootRepository> { /** *

禁用指定的数据

* - * @param id 主键 ID + * @param id 主键 {@code ID} * @apiNote 不建议直接调用, 请优先使用前后置方法 * @see #beforeDisable(long) * @see #afterDisable(long) @@ -650,7 +650,7 @@ public class RootService, R extends RootRepository> { /** *

启用指定的数据

* - * @param id 主键 ID + * @param id 主键 {@code ID} * @apiNote 不建议直接调用, 请优先使用前后置方法 * @see #beforeEnable(long) * @see #afterEnable(long) @@ -663,7 +663,7 @@ public class RootService, R extends RootRepository> { /** *

删除指定的数据

* - * @param id 主键 ID + * @param id 主键 {@code ID} * @apiNote 不建议直接调用, 请优先使用前后置方法 * @see #beforeDelete(long) * @see #afterDelete(long) @@ -702,7 +702,7 @@ public class RootService, R extends RootRepository> { } /** - *

添加查询条件(value不为null时)

+ *

添加查询条件({@code value}不为{@code null}时)

* * @param root ROOT * @param predicateList 查询条件列表 @@ -819,7 +819,7 @@ public class RootService, R extends RootRepository> { /** *

更新到数据库

* - * @param withNull 是否更新 null 属性 + * @param withNull 是否更新 {@code null} 属性 * @param source 原始数据 */ private void updateToDatabase(boolean withNull, @NotNull E source) { @@ -834,9 +834,9 @@ public class RootService, R extends RootRepository> { } /** - *

根据ID查询对应的实体

+ *

根据{@code ID}查询对应的实体

* - * @param id 主键 ID + * @param id 主键 {@code ID} * @return 实体 */ private @NotNull E getById(long id) { @@ -855,7 +855,7 @@ public class RootService, R extends RootRepository> { /** *

根据ID查询对应的实体

* - * @param id 主键 ID + * @param id 主键 {@code ID} * @return 实体 * @apiNote 查不到返回null,不抛异常 */ @@ -1013,7 +1013,7 @@ public class RootService, R extends RootRepository> { } /** - *

获取值为null的属性

+ *

获取值为{@code null}的属性

* * @param sourceEntity 来源对象 * @return 非空属性列表 @@ -1045,7 +1045,7 @@ public class RootService, R extends RootRepository> { } /** - *

创建Sort

+ *

创建{@code Sort}

* * @param sort 排序对象 * @return Sort Spring的排序对象 @@ -1071,7 +1071,7 @@ public class RootService, R extends RootRepository> { } /** - *

创建Pageable

+ *

创建{@code Pageable}

* * @param queryPageData 查询请求 * @return Pageable diff --git a/airpower-core/src/main/java/cn/hamm/airpower/util/AesUtil.java b/airpower-core/src/main/java/cn/hamm/airpower/util/AesUtil.java index 7b4ad22..5e559ed 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/util/AesUtil.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/util/AesUtil.java @@ -16,7 +16,7 @@ import java.security.SecureRandom; import java.util.Base64; /** - *

AES 助手

+ *

{@code AES} 助手

* * @author Hamm.cn */ @@ -33,7 +33,7 @@ public class AesUtil { private static final String AES = "AES"; /** - *

AES/CBC/PKCS5Padding

+ *

{@code AES/CBC/PKCS5Padding}

*/ private static final String AES_CBC_PKCS5_PADDING = "AES/CBC/PKCS5Padding"; @@ -92,7 +92,7 @@ public class AesUtil { *

设置偏移向量

* * @param iv 偏移向量 - * @return AesUtil + * @return {@code AesUtil} */ public AesUtil setIv(String iv) { this.iv = Base64.getDecoder().decode(iv); @@ -103,7 +103,7 @@ public class AesUtil { *

设置算法

* * @param algorithm 算法 - * @return AesUtil + * @return {@code AesUtil} */ public AesUtil setAlgorithm(String algorithm) { this.algorithm = algorithm; @@ -114,7 +114,7 @@ public class AesUtil { *

设置密钥

* * @param key 密钥 - * @return AesUtil + * @return {@code AesUtil} */ public AesUtil setKey(String key) { this.key = Base64.getDecoder().decode(key); @@ -151,10 +151,10 @@ public class AesUtil { } /** - *

获取 Cipher

+ *

获取 {@code Cipher}

* * @param mode 模式 - * @return Cipher + * @return {@code Cipher} */ private @NotNull Cipher getCipher(int mode) { try { diff --git a/airpower-core/src/main/java/cn/hamm/airpower/util/CollectionUtil.java b/airpower-core/src/main/java/cn/hamm/airpower/util/CollectionUtil.java index 0cb51c7..0676844 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/util/CollectionUtil.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/util/CollectionUtil.java @@ -13,7 +13,7 @@ import java.util.*; @Component public class CollectionUtil { /** - *

获取集合中的非 null 元素

+ *

获取集合中的非 {@code null} 元素

* * @param list 原始集合 * @param fieldClass 数据类型 diff --git a/airpower-core/src/main/java/cn/hamm/airpower/util/CookieUtil.java b/airpower-core/src/main/java/cn/hamm/airpower/util/CookieUtil.java index ec4fd5c..00fd1c5 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/util/CookieUtil.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/util/CookieUtil.java @@ -7,18 +7,18 @@ import org.jetbrains.annotations.NotNull; import org.springframework.stereotype.Component; /** - *

Cookie 助手

+ *

{@code Cookie} 助手

* * @author Hamm.cn */ @Component public class CookieUtil { /** - *

获取一个 Cookie

+ *

获取一个 {@code Cookie}

* * @param key Key * @param value Value - * @return Cookie + * @return {@code Cookie} * @see CookieConfig */ public final @NotNull Cookie getCookie(String key, String value) { @@ -31,10 +31,10 @@ public class CookieUtil { } /** - *

获取一个身份验证的 Cookie

+ *

获取一个身份验证的 {@code Cookie}

* * @param value 身份串的值 - * @return Cookie + * @return {@code Cookie} * @see CookieConfig */ public final @NotNull Cookie getAuthorizeCookie(String value) { diff --git a/airpower-core/src/main/java/cn/hamm/airpower/util/DictionaryUtil.java b/airpower-core/src/main/java/cn/hamm/airpower/util/DictionaryUtil.java index c691607..331eed3 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/util/DictionaryUtil.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/util/DictionaryUtil.java @@ -59,7 +59,7 @@ public class DictionaryUtil { } /** - *

获取指定枚举类的 ListMap 数据

+ *

获取指定枚举类的 {@code ListMap} 数据

* * @param clazz 枚举类 * @return ListMap @@ -69,7 +69,7 @@ public class DictionaryUtil { } /** - *

获取指定枚举类的 ListMap 数据

+ *

获取指定枚举类的 {@code ListMap} 数据

* * @param clazz 枚举字典类 * @param lambdas 需要获取的方法表达式 diff --git a/airpower-core/src/main/java/cn/hamm/airpower/util/HttpUtil.java b/airpower-core/src/main/java/cn/hamm/airpower/util/HttpUtil.java index 95f6efe..75290d8 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/util/HttpUtil.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/util/HttpUtil.java @@ -59,11 +59,11 @@ public class HttpUtil { private int connectTimeout = 5; /** - *

添加 Cookie

+ *

添加 {@code Cookie}

* * @param key Key * @param value Value - * @return HttpUtil + * @return {@code HttpUtil} */ @Contract("_, _ -> this") public final HttpUtil addCookie(String key, String value) { @@ -72,9 +72,9 @@ public class HttpUtil { } /** - *

发送 POST 请求

+ *

发送 {@code POST} 请求

* - * @return HttpResponse + * @return {@code HttpResponse} */ public final HttpResponse post() { method = HttpMethod.POST; @@ -82,10 +82,10 @@ public class HttpUtil { } /** - *

发送 POST 请求

+ *

发送 {@code POST} 请求

* * @param body 请求体 - * @return HttpResponse + * @return {@code HttpResponse} */ public final HttpResponse post(String body) { method = HttpMethod.POST; @@ -96,7 +96,7 @@ public class HttpUtil { /** *

发送GET请求

* - * @return HttpResponse + * @return {@code HttpResponse} */ public final HttpResponse get() { method = HttpMethod.GET; @@ -106,7 +106,7 @@ public class HttpUtil { /** *

发送请求

* - * @return HttpResponse + * @return {@code HttpResponse} */ public final HttpResponse send() { try { @@ -117,9 +117,9 @@ public class HttpUtil { } /** - *

获取 HttpRequest 对象

+ *

获取 {@code HttpRequest} 对象

* - * @return HttpRequest + * @return {@code HttpRequest} */ private HttpRequest getHttpRequest() { HttpRequest.Builder requestBuilder = HttpRequest.newBuilder() @@ -146,9 +146,9 @@ public class HttpUtil { } /** - *

获取 HttpClient

+ *

获取 {@code HttpClient}

* - * @return HttpClient + * @return {@code HttpClient} */ private HttpClient getHttpClient() { HttpClient.Builder httpClientBuilder = HttpClient.newBuilder(); @@ -159,11 +159,11 @@ public class HttpUtil { } /** - *

添加 Header

+ *

添加 {@code Header}

* * @param key Key * @param value Value - * @return HttpUtil + * @return {@code HttpUtil} */ @Contract("_, _ -> this") public final HttpUtil addHeader(String key, Object value) { diff --git a/airpower-core/src/main/java/cn/hamm/airpower/util/MqttUtil.java b/airpower-core/src/main/java/cn/hamm/airpower/util/MqttUtil.java index 70a583d..7755708 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/util/MqttUtil.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/util/MqttUtil.java @@ -11,7 +11,7 @@ import org.springframework.context.annotation.Configuration; import java.util.UUID; /** - *

MQTT 助手类

+ *

{@code MQTT} 助手类

* * @author Hamm.cn */ @@ -20,7 +20,7 @@ import java.util.UUID; public class MqttUtil { /** - *

创建 MQTT 客户端

+ *

创建 {@code MQTT} 客户端

* * @return 配置 * @throws MqttException 异常 @@ -30,9 +30,9 @@ public class MqttUtil { } /** - *

创建 MQTT 客户端

+ *

创建 {@code MQTT} 客户端

* - * @param id 客户端 ID + * @param id 客户端 {@code ID} * @return 配置 * @throws MqttException 异常 */ diff --git a/airpower-core/src/main/java/cn/hamm/airpower/util/PasswordUtil.java b/airpower-core/src/main/java/cn/hamm/airpower/util/PasswordUtil.java index 866c9f7..d96c45f 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/util/PasswordUtil.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/util/PasswordUtil.java @@ -18,7 +18,7 @@ public class PasswordUtil { * * @param password 明文密码 * @param salt 盐 - * @return sha1 散列摘要 + * @return {@code sha1} 散列摘要 */ public @NotNull String encode(@NotNull String password, @NotNull String salt) { ServiceError.PARAM_MISSING.whenEmpty(password, MessageConstant.PASSWORD_CAN_NOT_BE_NULL); diff --git a/airpower-core/src/main/java/cn/hamm/airpower/util/RedisUtil.java b/airpower-core/src/main/java/cn/hamm/airpower/util/RedisUtil.java index 5c941a1..3fbf140 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/util/RedisUtil.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/util/RedisUtil.java @@ -19,7 +19,7 @@ import java.util.Set; import java.util.concurrent.TimeUnit; /** - *

Redis 封装类

+ *

{@code Redis} 封装类

* * @author Hamm.cn */ @@ -51,7 +51,7 @@ public class RedisUtil { /** *

从缓存中获取实体

* - * @param key 缓存的 Key + * @param key 缓存的 {@code Key} * @param entity 实体 * @return 缓存的实体 */ @@ -99,7 +99,7 @@ public class RedisUtil { /** *

缓存实体

* - * @param key 缓存的 Key + * @param key 缓存的 {@code Key} * @param entity 实体 */ public final > void saveEntity(String key, E entity) { @@ -109,7 +109,7 @@ public class RedisUtil { /** *

缓存实体

* - * @param key 缓存的 Key + * @param key 缓存的 {@code Key} * @param entity 实体 * @param second 缓存时间(秒) */ @@ -120,7 +120,7 @@ public class RedisUtil { /** *

指定缓存失效时间

* - * @param key 缓存的 Key + * @param key 缓存的 {@code Key} * @param second 缓存时间(秒) */ public final void setExpireSecond(String key, long second) { @@ -154,7 +154,7 @@ public class RedisUtil { /** *

获取过期时间

* - * @param key 缓存的 Key + * @param key 缓存的 {@code Key} * @return 过期时间 */ public final long getExpireSecond(String key) { @@ -171,8 +171,8 @@ public class RedisUtil { /** *

判断key是否存在

* - * @param key 缓存的 Key - * @return true 存在; false 不存在 + * @param key 缓存的 {@code Key} + * @return {@code true} 存在; {@code false} 不存在 */ public final boolean hasKey(String key) { try { @@ -186,7 +186,7 @@ public class RedisUtil { /** *

删除缓存

* - * @param key 缓存的 Key + * @param key 缓存的 {@code Key} */ public final void del(String key) { try { @@ -200,7 +200,7 @@ public class RedisUtil { /** *

普通缓存获取

* - * @param key 缓存的 Key + * @param key 缓存的 {@code Key} * @return 值 */ public final @Nullable Object get(String key) { @@ -216,7 +216,7 @@ public class RedisUtil { /** *

普通缓存放入

* - * @param key 缓存的 Key + * @param key 缓存的 {@code Key} * @param value 值 */ public final void set(String key, Object value) { @@ -226,7 +226,7 @@ public class RedisUtil { /** *

普通缓存放入并设置时间

* - * @param key 缓存的 Key + * @param key 缓存的 {@code Key} * @param value 缓存的值 * @param second 缓存时间(秒) * @apiNote time要大于0 如果time小于等于0 将设置无限期 @@ -257,7 +257,7 @@ public class RedisUtil { } /** - *

获取缓存 EntitycacheKey

+ *

获取缓存 {@code Entity} 的 {@code cacheKey}

* * @param entity 实体 * @return key diff --git a/airpower-core/src/main/java/cn/hamm/airpower/util/ReflectUtil.java b/airpower-core/src/main/java/cn/hamm/airpower/util/ReflectUtil.java index 3205ac4..7318a30 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/util/ReflectUtil.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/util/ReflectUtil.java @@ -213,7 +213,7 @@ public class ReflectUtil { } /** - *

是否是继承自 RootEntity

+ *

是否是继承自 {@code RootEntity}

* * @param clazz 类 * @return 布尔 @@ -229,7 +229,7 @@ public class ReflectUtil { } /** - *

是否是继承自 RootModel

+ *

是否是继承自 {@code RootModel}

* * @param clazz 类 * @return 布尔 @@ -283,7 +283,7 @@ public class ReflectUtil { } /** - *

获取 LambdaFunction 表达式的函数名

+ *

获取 {@code Lambda} 的 {@code Function} 表达式的函数名

* * @param lambda 表达式 * @return 函数名 @@ -295,7 +295,7 @@ public class ReflectUtil { } /** - *

获取 LambdaFunction 类的函数名

+ *

获取 {@code Lambda} 的 {@code Function} 类的函数名

* * @param lambda 表达式 * @return 类名 @@ -307,10 +307,10 @@ public class ReflectUtil { } /** - *

获取一个 SerializedLambda

+ *

获取一个 {@code SerializedLambda}

* * @param lambda 表达式 - * @return SerializedLambda + * @return {@code SerializedLambda} */ private SerializedLambda getSerializedLambda(@NotNull IFunction lambda) { try { diff --git a/airpower-core/src/main/java/cn/hamm/airpower/util/RsaUtil.java b/airpower-core/src/main/java/cn/hamm/airpower/util/RsaUtil.java index f55153d..c581b09 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/util/RsaUtil.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/util/RsaUtil.java @@ -18,7 +18,7 @@ import java.security.spec.X509EncodedKeySpec; import java.util.Base64; /** - *

RSA 加解密助手类

+ *

{@code RSA} 加解密助手类

* * @author Hamm.cn */ @@ -27,7 +27,7 @@ import java.util.Base64; @Component public class RsaUtil { /** - *

加密算法 KEY 长度

+ *

加密算法 {@code KEY} 长度

*/ private final int CRYPT_KEY_SIZE = 2048; /** @@ -182,9 +182,9 @@ public class RsaUtil { } /** - *

RSA 处理方法

+ *

{@code RSA} 处理方法

* - * @param cipher RSA 实例 + * @param cipher {@code RSA} 实例 * @param sourceBytes 加解密原始数据 * @param blockSize 分片大小 * @return 加解密结果 @@ -210,9 +210,9 @@ public class RsaUtil { } /** - *

生成 RSA 密钥对

+ *

生成 {@code RSA} 密钥对

* - * @return KeyPair + * @return {@code KeyPair} */ public final KeyPair generateKeyPair() throws NoSuchAlgorithmException { KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance(CRYPT_METHOD); @@ -221,10 +221,10 @@ public class RsaUtil { } /** - *

将公钥转换为 PEM 格式

+ *

将公钥转换为 {@code PEM} 格式

* * @param publicKey 公钥 - * @return PEM + * @return {@code PEM} */ public final @NotNull String convertPublicKeyToPem(@NotNull PublicKey publicKey) { byte[] encoded = publicKey.getEncoded(); @@ -235,10 +235,10 @@ public class RsaUtil { } /** - *

将私钥转换为 PEM 格式

+ *

将私钥转换为 {@code PEM} 格式

* * @param privateKey 私钥 - * @return PEM + * @return {@code PEM} */ public final @NotNull String convertPrivateKeyToPem(@NotNull PrivateKey privateKey) { byte[] encoded = privateKey.getEncoded(); @@ -249,9 +249,9 @@ public class RsaUtil { } /** - *

Base64 编码的文本换行

+ *

将 {@code Base64} 编码的文本换行

* - * @param base64Text 原始 Base64 + * @param base64Text 原始 {@code Base64} * @return 换行后的 */ private @NotNull String wrapBase64Text(@NotNull String base64Text) { diff --git a/airpower-core/src/main/java/cn/hamm/airpower/util/SecurityUtil.java b/airpower-core/src/main/java/cn/hamm/airpower/util/SecurityUtil.java index cdc0883..f6f1af8 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/util/SecurityUtil.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/util/SecurityUtil.java @@ -13,9 +13,9 @@ import org.springframework.stereotype.Component; @Component public class SecurityUtil { /** - *

AccessToken 中获取 ID

+ *

从 {@code AccessToken} 中获取 {@code ID}

* - * @param accessToken AccessToken + * @param accessToken {@code AccessToken} */ public final long getIdFromAccessToken(String accessToken) { ServiceError.UNAUTHORIZED.whenNull(accessToken); @@ -27,10 +27,10 @@ public class SecurityUtil { } /** - *

创建一个 AccessToken

+ *

创建一个 {@code AccessToken}

* - * @param id TokenID - * @return AccessToken + * @param id {@code TokenID} + * @return {@code AccessToken} */ public final String createAccessToken(Long id) { return Utils.getTokenUtil().addPayload(Constant.ID, id) diff --git a/airpower-core/src/main/java/cn/hamm/airpower/util/StringUtil.java b/airpower-core/src/main/java/cn/hamm/airpower/util/StringUtil.java index 9033bde..20d8dff 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/util/StringUtil.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/util/StringUtil.java @@ -17,7 +17,7 @@ import java.util.stream.IntStream; @Component public class StringUtil { /** - *

IPV4 的块长度

+ *

{@code IPV4} 的块长度

*/ private static final int IPV4_PART_COUNT = 4; @@ -49,11 +49,11 @@ public class StringUtil { } /** - *

IPv4 地址脱敏

+ *

{@code IPv4} 地址脱敏

* - * @param ipv4 IPv4 地址 + * @param ipv4 {@code IPv4} 地址 * @param symbol 符号 - * @return 脱敏后的 IPv4 地址 + * @return 脱敏后的 {@code IPv4} 地址 */ public final @NotNull String desensitizeIpv4Address(@NotNull String ipv4, String symbol) { if (!StringUtils.hasText(symbol)) { @@ -69,10 +69,10 @@ public class StringUtil { } /** - *

IPv4 地址脱敏

+ *

{@code IPv4} 地址脱敏

* - * @param ipv4 IPv4 地址 - * @return 脱敏后的 IPv4 地址 + * @param ipv4 {@code IPv4} 地址 + * @return 脱敏后的 {@code IPv4} 地址 */ public final @NotNull String desensitizeIpv4Address(@NotNull String ipv4) { return desensitizeIpv4Address(ipv4, Constant.ASTERISK); diff --git a/airpower-core/src/main/java/cn/hamm/airpower/util/TaskUtil.java b/airpower-core/src/main/java/cn/hamm/airpower/util/TaskUtil.java index b567d22..ff496ff 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/util/TaskUtil.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/util/TaskUtil.java @@ -17,7 +17,7 @@ import java.util.List; @Component public class TaskUtil { /** - *

执行任务不会抛出异常

+ *

执行任务{@code 不会抛出异常}

* * @param runnable 任务 * @param moreRunnable 更多任务 @@ -34,7 +34,7 @@ public class TaskUtil { } /** - *

异步执行任务不会抛出异常

+ *

异步执行任务{@code 不会抛出异常}

* * @param runnable 任务 * @param moreRunnable 更多任务 diff --git a/airpower-core/src/main/java/cn/hamm/airpower/util/TokenUtil.java b/airpower-core/src/main/java/cn/hamm/airpower/util/TokenUtil.java index d19759e..f49d4de 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/util/TokenUtil.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/util/TokenUtil.java @@ -20,7 +20,7 @@ import java.util.HashMap; import java.util.Map; /** - *

TokenUtil

+ *

{@code TokenUtil}

* * @author Hamm.cn */ @@ -43,17 +43,17 @@ public class TokenUtil { private static final String PAYLOADS_IS_EMPTY = "没有任何负载数据"; /** - *

HMAC-SHA-256错误

+ *

{@code HMAC-SHA-256}错误

*/ private static final String HMAC_SHA_256_ERROR = "HMAC-SHA-256发生错误"; /** - *

Token3 部分组成

+ *

{@code Token} 由 {@code 3} 部分组成

*/ private static final int TOKEN_PART_COUNT = 3; /** - *

验证后的 Token

+ *

验证后的 {@code Token}

*/ private final VerifiedToken verifiedToken; @@ -63,10 +63,10 @@ public class TokenUtil { } /** - *

创建 Token

+ *

创建 {@code Token}

* * @param secret 密钥 - * @return AccessToken + * @return {@code AccessToken} */ public final String create(String secret) { ServiceError.PARAM_INVALID.whenEquals(Constant.AIRPOWER, secret, "身份令牌创建失败,请在环境变量配置 airpower.accessTokenSecret"); @@ -81,9 +81,9 @@ public class TokenUtil { /** *

添加负载

* - * @param key 负载的 Key - * @param value 负载的 Value - * @return TokenUtil + * @param key 负载的 {@code Key} + * @param value 负载的 {@code Value} + * @return {@code TokenUtil} */ @Contract("_, _ -> this") public final TokenUtil addPayload(String key, Object value) { @@ -94,8 +94,8 @@ public class TokenUtil { /** *

移除负载

* - * @param key 负载 Key - * @return TokenUtil + * @param key 负载 {@code Key} + * @return {@code TokenUtil} */ @Contract("_ -> this") public final TokenUtil removePayload(String key) { @@ -107,7 +107,7 @@ public class TokenUtil { *

设置过期时间(毫秒)

* * @param millisecond 过期毫秒 - * @return TokenUtil + * @return {@code TokenUtil} */ @Contract("_ -> this") public final TokenUtil setExpireMillisecond(long millisecond) { @@ -119,11 +119,11 @@ public class TokenUtil { } /** - *

验证 AccessToken 并返回一个已验证的 Token

+ *

验证 {@code AccessToken} 并返回一个已验证的 {@code Token}

* - * @param accessToken AccessToken + * @param accessToken {@code AccessToken} * @param secret 密钥 - * @return VerifiedToken + * @return {@code VerifiedToken} */ public final VerifiedToken verify(@NotNull String accessToken, String secret) { String source; @@ -152,7 +152,7 @@ public class TokenUtil { } /** - *

HMacSha256

+ *

{@code HMacSha256}

* * @param secret 密钥 * @param content 数据 @@ -195,8 +195,8 @@ public class TokenUtil { /** *

获取负载

* - * @param key 负载的 Key - * @return 负载的 Value + * @param key 负载的 {@code Key} + * @return 负载的 {@code Value} */ public final @Nullable Object getPayload(String key) { return payloads.get(key); diff --git a/airpower-core/src/main/java/cn/hamm/airpower/util/TreeUtil.java b/airpower-core/src/main/java/cn/hamm/airpower/util/TreeUtil.java index 6fe0f7e..0f37dd8 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/util/TreeUtil.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/util/TreeUtil.java @@ -29,7 +29,7 @@ public class TreeUtil { *

生成树结构

* * @param list 原始数据列表 - * @param parentId 父级 ID + * @param parentId 父级 {@code ID} * @param 泛型 * @return 数结构数组 */ diff --git a/airpower-core/src/main/java/cn/hamm/airpower/util/Utils.java b/airpower-core/src/main/java/cn/hamm/airpower/util/Utils.java index 52f3c61..cbd997f 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/util/Utils.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/util/Utils.java @@ -12,14 +12,14 @@ import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; /** - *

AirPower 工具包

+ *

{@code AirPower} 工具包

* * @author Hamm.cn */ @Component public class Utils { /** - *

Redis 工具类

+ *

{@code Redis} 工具类

*/ @Getter private static RedisUtil redisUtil; @@ -49,19 +49,19 @@ public class Utils { private static SecurityUtil securityUtil; /** - *

RSA 工具类

+ *

{@code RSA} 工具类

*/ @Getter private static RsaUtil rsaUtil; /** - *

Cookie 工具类

+ *

{@code Cookie} 工具类

*/ @Getter private static CookieUtil cookieUtil; /** - *

MQTT 工具类

+ *

{@code MQTT} 工具类

*/ @Getter private static MqttUtil mqttUtil; @@ -121,7 +121,7 @@ public class Utils { private static Environment environment; /** - *

JPA 实体管理器

+ *

{@code JPA} 实体管理器

*/ @Getter private static EntityManager entityManager; @@ -139,7 +139,7 @@ public class Utils { private static HttpServletResponse response; /** - *

WebSocket 工具类

+ *

{@code WebSocket} 工具类

*/ @Getter private static WebsocketUtil websocketUtil; @@ -157,7 +157,7 @@ public class Utils { private static StringUtil stringUtil; /** - *

AES 工具

+ *

{@code AES} 工具

*/ @Getter private static AesUtil aesUtil; diff --git a/airpower-core/src/main/java/cn/hamm/airpower/util/ValidateUtil.java b/airpower-core/src/main/java/cn/hamm/airpower/util/ValidateUtil.java index 69af335..f786d65 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/util/ValidateUtil.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/util/ValidateUtil.java @@ -120,7 +120,7 @@ public class ValidateUtil { *

是否是普通字符

* 允许字符: *

- * @ # % a-z A-Z 0-9 汉字 _ + / + * {@code @ # % a-z A-Z 0-9 汉字 _ + /} *

* * @param value 参数 @@ -176,7 +176,7 @@ public class ValidateUtil { *

验证传入的数据模型

* * @param model 数据模型 - * @param actions 可选 校验分组 + * @param actions {@code 可选} 校验分组 * @param 模型类型 */ public final > void valid(M model, Class... actions) { diff --git a/airpower-core/src/main/java/cn/hamm/airpower/websocket/WebSocketEvent.java b/airpower-core/src/main/java/cn/hamm/airpower/websocket/WebSocketEvent.java index fae8862..a4becc8 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/websocket/WebSocketEvent.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/websocket/WebSocketEvent.java @@ -11,7 +11,7 @@ import java.util.Base64; import java.util.concurrent.atomic.AtomicLong; /** - *

WebSocket 事件

+ *

{@code WebSocket} 事件

* * @author Hamm.cn */ @@ -19,22 +19,22 @@ import java.util.concurrent.atomic.AtomicLong; @Accessors(chain = true) public class WebSocketEvent { /** - *

当前事件 ID

+ *

当前事件 {@code ID}

*/ private static final AtomicLong CURRENT_EVENT_ID = new AtomicLong(Constant.ZERO_LONG); /** - *

事件 ID

+ *

事件 {@code ID}

*/ private String id; /** - *

发送方 ID

+ *

发送方 {@code ID}

*/ private long from = Constant.ZERO_LONG; /** - *

接收方 ID

+ *

接收方 {@code ID}

*/ private long to = Constant.ZERO_LONG; @@ -49,7 +49,7 @@ public class WebSocketEvent { private WebSocketPayload payload; /** - *

创建 WebSocket 事件

+ *

创建 {@code WebSocket} 事件

* * @param payload 负载 * @return 事件 @@ -59,7 +59,7 @@ public class WebSocketEvent { } /** - *

创建 WebSocket 事件

+ *

创建 {@code WebSocket} 事件

* * @return 事件 */ @@ -70,7 +70,7 @@ public class WebSocketEvent { } /** - *

重置事件的 ID 和事件

+ *

重置事件的 {@code ID} 和事件

*/ protected final void resetEvent() { long time = System.currentTimeMillis(); diff --git a/airpower-core/src/main/java/cn/hamm/airpower/websocket/WebSocketHandler.java b/airpower-core/src/main/java/cn/hamm/airpower/websocket/WebSocketHandler.java index e2471ef..6d281e9 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/websocket/WebSocketHandler.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/websocket/WebSocketHandler.java @@ -42,28 +42,28 @@ public class WebSocketHandler extends TextWebSocketHandler implements MessageLis public static final String CHANNEL_USER_PREFIX = "WEBSOCKET_USER_"; /** - *

Redis 连接列表

+ *

{@code Redis} 连接列表

*/ protected final ConcurrentHashMap redisConnectionHashMap = new ConcurrentHashMap<>(); /** - *

MQTT 客户端列表

+ *

{@code MQTT} 客户端列表

*/ protected final ConcurrentHashMap mqttClientHashMap = new ConcurrentHashMap<>(); /** - *

用户 ID 列表

+ *

用户 {@code ID} 列表

*/ protected final ConcurrentHashMap userIdHashMap = new ConcurrentHashMap<>(); /** - *

Redis 连接工厂

+ *

{@code Redis} 连接工厂

*/ @Autowired private RedisConnectionFactory redisConnectionFactory; /** - *

收到 Websocket 消息时

+ *

收到 {@code Websocket} 消息时

* * @param session 会话 * @param textMessage 文本消息 @@ -88,7 +88,7 @@ public class WebSocketHandler extends TextWebSocketHandler implements MessageLis } /** - *

发送 Websocket 事件负载

+ *

发送 {@code Websocket} 事件负载

* * @param session 会话 * @param webSocketPayload 事件负载 @@ -102,7 +102,7 @@ public class WebSocketHandler extends TextWebSocketHandler implements MessageLis } /** - *

WebSocket 负载到达时

+ *

当 {@code WebSocket} 负载到达时

* * @param webSocketPayload 负载对象 */ @@ -152,10 +152,10 @@ public class WebSocketHandler extends TextWebSocketHandler implements MessageLis } /** - *

开始监听 Redis 消息

+ *

开始监听 {@code Redis} 消息

* - * @param session WebSocket 会话 - * @param userId 用户 ID + * @param session {@code WebSocket} 会话 + * @param userId 用户 {@code ID} */ private void startRedisListener(@NotNull WebSocketSession session, long userId) { final String personalChannel = getRealChannel(CHANNEL_USER_PREFIX + userId); @@ -173,10 +173,10 @@ public class WebSocketHandler extends TextWebSocketHandler implements MessageLis } /** - *

开始监听 MQTT 消息

+ *

开始监听 {@code MQTT} 消息

* - * @param session WebSocket 会话 - * @param userId 用户 ID + * @param session {@code WebSocket} 会话 + * @param userId 用户 {@code ID} */ private void startMqttListener(@NotNull WebSocketSession session, long userId) { try (MqttClient mqttClient = Utils.getMqttUtil().createClient()) { @@ -245,10 +245,10 @@ public class WebSocketHandler extends TextWebSocketHandler implements MessageLis } /** - *

REDIS 订阅

+ *

{@code REDIS} 订阅

* * @param channel 传入的频道 - * @param session WebSocket 会话 + * @param session {@code WebSocket} 会话 */ protected final void redisSubscribe(@NotNull String channel, WebSocketSession session) { log.info("REDIS开始订阅频道: {}", getRealChannel(channel)); @@ -256,10 +256,10 @@ public class WebSocketHandler extends TextWebSocketHandler implements MessageLis } /** - *

MQTT 订阅

+ *

{@code MQTT} 订阅

* * @param channel 传入的频道 - * @param session WebSocket 会话 + * @param session {@code WebSocket} 会话 */ protected final void mqttSubscribe(String channel, WebSocketSession session) { log.info("MQTT开始订阅频道: {}", getRealChannel(channel)); @@ -281,10 +281,10 @@ public class WebSocketHandler extends TextWebSocketHandler implements MessageLis } /** - *

Redis 取消订阅

+ *

{@code Redis} 取消订阅

* * @param channel 传入的频道 - * @param session WebSocket 会话 + * @param session {@code WebSocket} 会话 */ protected final void redisUnSubscribe(@NotNull String channel, WebSocketSession session) { log.info("REDIS取消订阅频道: {}", getRealChannel(channel)); @@ -292,10 +292,10 @@ public class WebSocketHandler extends TextWebSocketHandler implements MessageLis } /** - *

MQTT 取消订阅

+ *

{@code MQTT} 取消订阅

* * @param channel 传入的频道 - * @param session WebSocket 会话 + * @param session {@code WebSocket} 会话 */ protected final void mqttUnSubscribe(String channel, WebSocketSession session) { log.info("MQTT取消订阅频道: {}", getRealChannel(channel)); @@ -307,10 +307,10 @@ public class WebSocketHandler extends TextWebSocketHandler implements MessageLis } /** - *

获取 MQTT 客户端

+ *

获取 {@code MQTT} 客户端

* - * @param session WebSocket 会话 - * @return MQTT 客户端 + * @param session {@code WebSocket} 会话 + * @return {@code MQTT} 客户端 */ protected final MqttClient getMqttClient(@NotNull WebSocketSession session) { MqttClient mqttClient = mqttClientHashMap.get(session.getId()); @@ -321,10 +321,10 @@ public class WebSocketHandler extends TextWebSocketHandler implements MessageLis } /** - *

获取 Redis 订阅

+ *

获取 {@code Redis} 订阅

* - * @param session WebSocket 会话 - * @return Redis 订阅 + * @param session {@code WebSocket} 会话 + * @return {@code Redis} 订阅 */ protected final Subscription getRedisSubscription(@NotNull WebSocketSession session) { RedisConnection redisConnection = redisConnectionHashMap.get(session.getId()); diff --git a/airpower-core/src/main/java/cn/hamm/airpower/websocket/WebSocketPayload.java b/airpower-core/src/main/java/cn/hamm/airpower/websocket/WebSocketPayload.java index 4e17aa0..5af1768 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/websocket/WebSocketPayload.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/websocket/WebSocketPayload.java @@ -4,7 +4,7 @@ import lombok.Data; import lombok.experimental.Accessors; /** - *

WebSocket 事件负载

+ *

{@code WebSocket} 事件负载

* * @author Hamm.cn */ diff --git a/airpower-core/src/main/java/cn/hamm/airpower/websocket/WebSocketSupport.java b/airpower-core/src/main/java/cn/hamm/airpower/websocket/WebSocketSupport.java index 5179ccf..b532366 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/websocket/WebSocketSupport.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/websocket/WebSocketSupport.java @@ -1,18 +1,18 @@ package cn.hamm.airpower.websocket; /** - *

WebSocket 支持

+ *

{@code WebSocket} 支持

* * @author Hamm.cn */ public enum WebSocketSupport { /** - *

Redis

+ *

{@code Redis}

*/ REDIS, /** - *

MQTT

+ *

{@code MQTT}

*/ MQTT, diff --git a/airpower-core/src/main/java/cn/hamm/airpower/websocket/WebsocketUtil.java b/airpower-core/src/main/java/cn/hamm/airpower/websocket/WebsocketUtil.java index 692f7ec..995c0b7 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/websocket/WebsocketUtil.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/websocket/WebsocketUtil.java @@ -32,7 +32,7 @@ public class WebsocketUtil { /** *

发布事件负载到指定的用户

* - * @param userId 目标用户 ID + * @param userId 目标用户 {@code ID} * @param payload 事件负载 */ public final void publishToUser(long userId, WebSocketPayload payload) { -- Gitee From 1aebcd4f790d58782fb18657cdaf1fcd884b6b5e Mon Sep 17 00:00:00 2001 From: Hamm Date: Tue, 9 Jul 2024 15:08:17 +0800 Subject: [PATCH 05/12] refactor(core): refine logic for field exposure in RootModel Improve the logic for deciding whether to expose or exclude fields in the RootModel based on the presence and filters of the Exclude and Expose annotations. This change modifies the BiConsumer task assignment to conditionally handle field exposure and adds clarity to the decision-making process for field sensitivity. BREAKING CHANGE: Consumers relying on the previous logic for field exposure will need to review their implementations to ensure compatibility with the refined logic. Signed-off-by: Hamm --- .../main/java/cn/hamm/airpower/root/RootModel.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/airpower-core/src/main/java/cn/hamm/airpower/root/RootModel.java b/airpower-core/src/main/java/cn/hamm/airpower/root/RootModel.java index ec68beb..1b8ed69 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/root/RootModel.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/root/RootModel.java @@ -84,7 +84,8 @@ public class RootModel> implements IAction { List allFields = reflectUtil.getFieldList(clazz); Exclude exclude = clazz.getAnnotation(Exclude.class); // 类中没有标排除 则所有字段全暴露 走黑名单 - BiConsumer<@NotNull Field, @NotNull Class> task = Objects.nonNull(exclude) ? this::exposeBy : this::excludeBy; + BiConsumer<@NotNull Field, @NotNull Class> task = Objects.nonNull(exclude) && Arrays.asList(exclude.filters()).contains(filterClass) ? + this::exposeBy : this::excludeBy; Consumer<@NotNull Field> desensitize = this::desensitize; allFields.forEach(field -> { if (!Void.class.equals(filterClass)) { @@ -153,6 +154,7 @@ public class RootModel> implements IAction { Method getMethod = getClass().getMethod(fieldGetter); Exclude methodExclude = reflectUtil.getAnnotation(Exclude.class, getMethod); if (Objects.nonNull(methodExclude)) { + // 属性的Getter上标记了排除 excludeClasses = methodExclude.filters(); } } catch (NoSuchMethodException exception) { @@ -161,9 +163,10 @@ public class RootModel> implements IAction { if (Objects.isNull(excludeClasses)) { Exclude fieldExclude = reflectUtil.getAnnotation(Exclude.class, field); if (Objects.isNull(fieldExclude)) { - reflectUtil.clearFieldValue(this, field); + // 属性Getter没标记 也没有属性本身标记 则暴露 return; } + // 属性Getter没标记 但是属性本身标记了 excludeClasses = fieldExclude.filters(); } @@ -189,24 +192,29 @@ public class RootModel> implements IAction { Method getMethod = getClass().getMethod(fieldGetter); Expose methodExpose = reflectUtil.getAnnotation(Expose.class, getMethod); if (Objects.nonNull(methodExpose)) { + // 属性的Getter标记了暴露 exposeClasses = methodExpose.filters(); } + // 属性的Getter没有标记 } catch (NoSuchMethodException exception) { log.error(exception.getMessage(), exception); } if (Objects.isNull(exposeClasses)) { Expose fieldExpose = reflectUtil.getAnnotation(Expose.class, field); if (Objects.isNull(fieldExpose)) { + // 属性以及Getter都没有标记暴露 则排除 + reflectUtil.clearFieldValue(this, field); return; } exposeClasses = fieldExpose.filters(); } if (exposeClasses.length == 0) { + // 虽然标记但未指定过滤器 所有场景都暴露 return; } - // 标记了暴露 boolean isExpose = Arrays.asList(exposeClasses).contains(filterClass); if (!isExpose) { + // 当前场景不在标记的暴露场景中 则排除 reflectUtil.clearFieldValue(this, field); } } -- Gitee From 97c40b94f38b9af9d571c3bc291dbef24741e609 Mon Sep 17 00:00:00 2001 From: Hamm Date: Tue, 9 Jul 2024 15:10:15 +0800 Subject: [PATCH 06/12] refactor(core): refine logic for field exposure in RootModel Improve the logic for deciding whether to expose or exclude fields in the RootModel based on the presence and filters of the Exclude and Expose annotations. This change modifies the BiConsumer task assignment to conditionally handle field exposure and adds clarity to the decision-making process for field sensitivity. BREAKING CHANGE: Consumers relying on the previous logic for field exposure will need to review their implementations to ensure compatibility with the refined logic. Signed-off-by: Hamm --- .../src/main/java/cn/hamm/airpower/root/RootModel.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/airpower-core/src/main/java/cn/hamm/airpower/root/RootModel.java b/airpower-core/src/main/java/cn/hamm/airpower/root/RootModel.java index 1b8ed69..fe5cc99 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/root/RootModel.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/root/RootModel.java @@ -84,8 +84,8 @@ public class RootModel> implements IAction { List allFields = reflectUtil.getFieldList(clazz); Exclude exclude = clazz.getAnnotation(Exclude.class); // 类中没有标排除 则所有字段全暴露 走黑名单 - BiConsumer<@NotNull Field, @NotNull Class> task = Objects.nonNull(exclude) && Arrays.asList(exclude.filters()).contains(filterClass) ? - this::exposeBy : this::excludeBy; + boolean isExpose = Objects.nonNull(exclude) && Arrays.asList(exclude.filters()).contains(filterClass); + BiConsumer<@NotNull Field, @NotNull Class> task = isExpose ? this::exposeBy : this::excludeBy; Consumer<@NotNull Field> desensitize = this::desensitize; allFields.forEach(field -> { if (!Void.class.equals(filterClass)) { -- Gitee From 8f47ce7de995ea6f57575a4f0820341b603c5c75 Mon Sep 17 00:00:00 2001 From: Hamm Date: Tue, 9 Jul 2024 15:22:51 +0800 Subject: [PATCH 07/12] refactor(core): refine logic for field exposure in RootModel Improve the logic for deciding whether to expose or exclude fields in the RootModel based on the presence and filters of the Exclude and Expose annotations. This change modifies the BiConsumer task assignment to conditionally handle field exposure and adds clarity to the decision-making process for field sensitivity. BREAKING CHANGE: Consumers relying on the previous logic for field exposure will need to review their implementations to ensure compatibility with the refined logic. Signed-off-by: Hamm --- .../java/cn/hamm/airpower/root/RootModel.java | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/airpower-core/src/main/java/cn/hamm/airpower/root/RootModel.java b/airpower-core/src/main/java/cn/hamm/airpower/root/RootModel.java index fe5cc99..e5158b7 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/root/RootModel.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/root/RootModel.java @@ -90,7 +90,7 @@ public class RootModel> implements IAction { allFields.forEach(field -> { if (!Void.class.equals(filterClass)) { task.accept(field, filterClass); - filterFieldPayload(field, isDesensitize); + filterFieldPayload(field, filterClass, isDesensitize); } if (isDesensitize) { desensitize.accept(field); @@ -225,11 +225,8 @@ public class RootModel> implements IAction { * @param field 字段 * @param isDesensitize 是否需要脱敏 */ - private void filterFieldPayload(@NotNull Field field, boolean isDesensitize) { + private void filterFieldPayload(@NotNull Field field, Class filterClass, boolean isDesensitize) { Payload payload = reflectUtil.getAnnotation(Payload.class, field); - if (Objects.isNull(payload)) { - return; - } Object fieldValue = reflectUtil.getFieldValue(this, field); Collection> collection; if (fieldValue instanceof Collection) { @@ -238,7 +235,10 @@ public class RootModel> implements IAction { collection = collectionUtil.getCollectWithoutNull( (Collection>) fieldValue, fieldClass ); - collection.forEach(item -> item.filterAndDesensitize(WhenPayLoad.class, isDesensitize)); + collection.forEach(item -> item.filterAndDesensitize(filterClass, isDesensitize)); + if (Objects.nonNull(payload)) { + collection.forEach(item -> item.filterAndDesensitize(WhenPayLoad.class, isDesensitize)); + } reflectUtil.setFieldValue(this, field, collection); return; } @@ -246,8 +246,14 @@ public class RootModel> implements IAction { return; } reflectUtil.setFieldValue(this, field, - ((RootModel) fieldValue).filterAndDesensitize(WhenPayLoad.class, isDesensitize) + ((RootModel) fieldValue).filterAndDesensitize(filterClass, isDesensitize) ); + + if (Objects.nonNull(payload)) { + reflectUtil.setFieldValue(this, field, + ((RootModel) fieldValue).filterAndDesensitize(WhenPayLoad.class, isDesensitize) + ); + } } /** -- Gitee From fbb220a51e722c8625199d46422d48287d699e27 Mon Sep 17 00:00:00 2001 From: Hamm Date: Tue, 9 Jul 2024 15:40:32 +0800 Subject: [PATCH 08/12] refactor(server): remove `Payload` annotation and related logic The `Payload` annotation along with its associated logic has been removed from the codebase. This involves changes to the `RootModel` class where the `filterFieldPayload` method has been replaced by `filterField`, ensuring that models without the`Payload` annotation are handled correctly. The update removes unnecessary checks for the presence of the annotation, simplifying the filtering process. BREAKING CHANGE: The removal of the `Payload` annotation may affect entities that relied on this annotation for special handling during data filtering Signed-off-by: Hamm --- .../cn/hamm/airpower/annotation/Payload.java | 17 -------------- .../java/cn/hamm/airpower/root/RootModel.java | 22 ++++++++----------- 2 files changed, 9 insertions(+), 30 deletions(-) delete mode 100644 airpower-core/src/main/java/cn/hamm/airpower/annotation/Payload.java diff --git a/airpower-core/src/main/java/cn/hamm/airpower/annotation/Payload.java b/airpower-core/src/main/java/cn/hamm/airpower/annotation/Payload.java deleted file mode 100644 index 249f08c..0000000 --- a/airpower-core/src/main/java/cn/hamm/airpower/annotation/Payload.java +++ /dev/null @@ -1,17 +0,0 @@ -package cn.hamm.airpower.annotation; - -import cn.hamm.airpower.interfaces.IAction; - -import java.lang.annotation.*; - -/** - *

标记是挂载数据

- * - * @author Hamm.cn - * @apiNote 标记此注解的属性将在控制器被标记 {@link Filter} 并指定过滤器为 {@link IAction.WhenPayLoad} 时不输出。 - */ -@Target({ElementType.FIELD}) -@Retention(RetentionPolicy.RUNTIME) -@Documented -public @interface Payload { -} diff --git a/airpower-core/src/main/java/cn/hamm/airpower/root/RootModel.java b/airpower-core/src/main/java/cn/hamm/airpower/root/RootModel.java index e5158b7..3dde88a 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/root/RootModel.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/root/RootModel.java @@ -90,7 +90,7 @@ public class RootModel> implements IAction { allFields.forEach(field -> { if (!Void.class.equals(filterClass)) { task.accept(field, filterClass); - filterFieldPayload(field, filterClass, isDesensitize); + filterField(field, filterClass, isDesensitize); } if (isDesensitize) { desensitize.accept(field); @@ -220,40 +220,36 @@ public class RootModel> implements IAction { } /** - *

挂载数据的Payload过滤

+ *

递归过滤和脱敏

* * @param field 字段 * @param isDesensitize 是否需要脱敏 */ - private void filterFieldPayload(@NotNull Field field, Class filterClass, boolean isDesensitize) { - Payload payload = reflectUtil.getAnnotation(Payload.class, field); + private void filterField(@NotNull Field field, Class filterClass, boolean isDesensitize) { Object fieldValue = reflectUtil.getFieldValue(this, field); Collection> collection; if (fieldValue instanceof Collection) { Class fieldClass = field.getType(); + if (!reflectUtil.isModel(fieldClass)) { + return; + } CollectionUtil collectionUtil = Utils.getCollectionUtil(); collection = collectionUtil.getCollectWithoutNull( (Collection>) fieldValue, fieldClass ); collection.forEach(item -> item.filterAndDesensitize(filterClass, isDesensitize)); - if (Objects.nonNull(payload)) { - collection.forEach(item -> item.filterAndDesensitize(WhenPayLoad.class, isDesensitize)); - } reflectUtil.setFieldValue(this, field, collection); return; } + if (!reflectUtil.isModel(field.getType())) { + return; + } if (Objects.isNull(fieldValue)) { return; } reflectUtil.setFieldValue(this, field, ((RootModel) fieldValue).filterAndDesensitize(filterClass, isDesensitize) ); - - if (Objects.nonNull(payload)) { - reflectUtil.setFieldValue(this, field, - ((RootModel) fieldValue).filterAndDesensitize(WhenPayLoad.class, isDesensitize) - ); - } } /** -- Gitee From fab700f9ef22a57ca2e8cdf0d90c9fe20ec694dc Mon Sep 17 00:00:00 2001 From: Hamm Date: Tue, 9 Jul 2024 15:48:40 +0800 Subject: [PATCH 09/12] refactor(server): remove `Payload` annotation and related logic The `Payload` annotation along with its associated logic has been removed from the codebase. This involves changes to the `RootModel` class where the `filterFieldPayload` method has been replaced by `filterField`, ensuring that models without the`Payload` annotation are handled correctly. The update removes unnecessary checks for the presence of the annotation, simplifying the filtering process. BREAKING CHANGE: The removal of the `Payload` annotation may affect entities that relied on this annotation for special handling during data filtering Signed-off-by: Hamm --- .../src/main/java/cn/hamm/airpower/interfaces/IAction.java | 5 ----- .../src/main/java/cn/hamm/airpower/root/RootEntity.java | 6 ------ 2 files changed, 11 deletions(-) diff --git a/airpower-core/src/main/java/cn/hamm/airpower/interfaces/IAction.java b/airpower-core/src/main/java/cn/hamm/airpower/interfaces/IAction.java index 5f014fe..59b0796 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/interfaces/IAction.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/interfaces/IAction.java @@ -6,9 +6,4 @@ package cn.hamm.airpower.interfaces; * @author Hamm.cn */ public interface IAction { - /** - *

当需要过滤挂载数据时

- */ - interface WhenPayLoad { - } } diff --git a/airpower-core/src/main/java/cn/hamm/airpower/root/RootEntity.java b/airpower-core/src/main/java/cn/hamm/airpower/root/RootEntity.java index 3bfd30f..87a1c0d 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/root/RootEntity.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/root/RootEntity.java @@ -53,7 +53,6 @@ public class RootEntity> extends RootModel @Search(Search.Mode.LIKE) @Column(columnDefinition = "text comment '备注'") @Length(max = 1000, message = "备注最多允许{max}个字符") - @Exclude(filters = {WhenPayLoad.class}) @ExcelColumn private String remark; @@ -61,35 +60,30 @@ public class RootEntity> extends RootModel @ReadOnly @Search(Search.Mode.EQUALS) @Column(columnDefinition = "tinyint UNSIGNED default 0 comment '是否禁用'") - @Exclude(filters = {WhenPayLoad.class}) @ExcelColumn(ExcelColumn.Type.BOOLEAN) private Boolean isDisabled; @Description("创建时间") @ReadOnly @Column(columnDefinition = "bigint UNSIGNED default 0 comment '创建时间'") - @Exclude(filters = {WhenPayLoad.class}) @ExcelColumn(ExcelColumn.Type.DATETIME) private Long createTime; @Description("创建人ID") @ReadOnly @Column(columnDefinition = "bigint UNSIGNED default 0 comment '创建人ID'") - @Exclude(filters = {WhenPayLoad.class}) @ExcelColumn(ExcelColumn.Type.NUMBER) private Long createUserId; @Description("修改人ID") @ReadOnly @Column(columnDefinition = "bigint UNSIGNED default 0 comment '修改人ID'") - @Exclude(filters = {WhenPayLoad.class}) @ExcelColumn(ExcelColumn.Type.NUMBER) private Long updateUserId; @Description("修改时间") @ReadOnly @Column(columnDefinition = "bigint UNSIGNED default 0 comment '修改时间'") - @Exclude(filters = {WhenPayLoad.class}) @ExcelColumn(ExcelColumn.Type.DATETIME) private Long updateTime; -- Gitee From e8614044c5a10540b542721c709b2bc471bfc739 Mon Sep 17 00:00:00 2001 From: Hamm Date: Tue, 9 Jul 2024 17:19:20 +0800 Subject: [PATCH 10/12] =?UTF-8?q?fix(desensitize):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E4=BA=86=E8=84=B1=E6=95=8F=E6=95=B0=E6=8D=AE=E7=9A=84=E5=A4=84?= =?UTF-8?q?=E7=90=86=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hamm/airpower/annotation/Desensitize.java | 35 ++++++++--- .../cn/hamm/airpower/util/StringUtil.java | 63 +++++++------------ 2 files changed, 46 insertions(+), 52 deletions(-) diff --git a/airpower-core/src/main/java/cn/hamm/airpower/annotation/Desensitize.java b/airpower-core/src/main/java/cn/hamm/airpower/annotation/Desensitize.java index 1d5a843..5dfd7bf 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/annotation/Desensitize.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/annotation/Desensitize.java @@ -1,5 +1,8 @@ package cn.hamm.airpower.annotation; +import lombok.AllArgsConstructor; +import lombok.Getter; + import java.lang.annotation.*; /** @@ -35,55 +38,67 @@ public @interface Desensitize { /** *

脱敏方式

*/ + @AllArgsConstructor + @Getter enum Type { /** *

座机号码

*/ - TELEPHONE, + TELEPHONE(0, 0), /** *

手机号码

*/ - MOBILE, + MOBILE(3, 4), /** *

身份证号

*/ - ID_CARD, + ID_CARD(6, 4), /** *

银行卡号

*/ - BANK_CARD, + BANK_CARD(4, 4), /** *

车牌号

*/ - CAR_NUMBER, + CAR_NUMBER(2, 1), /** *

邮箱

*/ - EMAIL, + EMAIL(2, 2), /** *

中文名

*/ - CHINESE_NAME, + CHINESE_NAME(1, 1), /** *

地址

*/ - ADDRESS, + ADDRESS(3, 0), /** *

IP地址(v4)

*/ - IP_V4, + IP_V4(0, 0), /** *

自定义

*/ - CUSTOM, + CUSTOM(0, 0); + + /** + *

开始至少保留

+ */ + private final int minHead; + + /** + *

结束至少保留

+ */ + private final int minTail; } } diff --git a/airpower-core/src/main/java/cn/hamm/airpower/util/StringUtil.java b/airpower-core/src/main/java/cn/hamm/airpower/util/StringUtil.java index 20d8dff..ba99a18 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/util/StringUtil.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/util/StringUtil.java @@ -31,10 +31,7 @@ public class StringUtil { * @return 替换后的字符串 */ public final @NotNull String replace(String text, int head, int tail, String symbol) { - if (head < 0 || tail < 0) { - return text; - } - if (head + tail >= text.length()) { + if (head < 0 || tail < 0 || head + tail >= text.length()) { return text; } StringBuilder stringBuilder = new StringBuilder(); @@ -104,54 +101,36 @@ public class StringUtil { */ @Contract(pure = true) public final @NotNull String desensitize(@NotNull String valueString, Desensitize.@NotNull Type type, int head, int tail, String symbol) { + final StringUtil stringUtil = Utils.getStringUtil(); switch (type) { + case BANK_CARD, + ID_CARD, + MOBILE, + ADDRESS, + CAR_NUMBER, + EMAIL -> { + head = Math.max(type.getMinHead(), head); + tail = Math.max(type.getMinTail(), tail); + } + case IP_V4 -> { + return stringUtil.desensitizeIpv4Address(valueString, symbol); + } case CHINESE_NAME -> { - head = Math.max(1, head); - tail = Math.max(1, tail); + head = Math.max(type.getMinHead(), head); + tail = Math.max(type.getMinTail(), tail); if (valueString.length() <= head + tail) { tail = 0; } } - case BANK_CARD -> { - head = Math.max(4, head); - tail = Math.max(4, tail); - } - case ID_CARD -> { - head = Math.max(6, head); - tail = Math.max(4, tail); - } - case MOBILE -> { - head = Math.max(3, head); - tail = Math.max(4, tail); - } - case EMAIL -> { - head = 2; - tail = 2; - } - case IP_V4 -> { - return Utils.getStringUtil().desensitizeIpv4Address(valueString, symbol); - } - case ADDRESS -> { - head = Math.max(3, head); - tail = Math.max(0, tail); - } case TELEPHONE -> { - //noinspection AlibabaUndefineMagicConstant - if (valueString.length() <= 8) { - head = Math.max(2, head); - tail = Math.max(2, tail); - } else { - head = Math.max(4, head); - tail = Math.max(4, tail); - } - } - case CAR_NUMBER -> { - head = Math.max(2, head); - tail = Math.max(1, tail); + // 包含区号 前后各留4 不包含则各留2 + int isContainRegionCode = valueString.length() > 8 ? 4 : 2; + head = Math.max(isContainRegionCode, head); + tail = Math.max(isContainRegionCode, tail); } default -> { } } - return Utils.getStringUtil().replace(valueString, head, tail, symbol); + return stringUtil.replace(valueString, head, tail, symbol); } } -- Gitee From 959076f9e3e25174b492f26f296bfcc52ed364a3 Mon Sep 17 00:00:00 2001 From: Hamm Date: Tue, 9 Jul 2024 19:29:24 +0800 Subject: [PATCH 11/12] feat(json): add parseList method and improve exception handling --- .../java/cn/hamm/airpower/model/Json.java | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/airpower-core/src/main/java/cn/hamm/airpower/model/Json.java b/airpower-core/src/main/java/cn/hamm/airpower/model/Json.java index d6c9af0..cec9503 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/model/Json.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/model/Json.java @@ -161,10 +161,27 @@ public class Json { * * @param json 字符串 * @param clazz 目标类 - * @param 目标类 + * @param 目标类 * @return 目标类的实例 */ - public static E parse(String json, Class clazz) { + public static T parse(String json, Class clazz) { + try { + return getObjectMapper().readValue(json, clazz); + } catch (JsonProcessingException exception) { + log.error(MessageConstant.EXCEPTION_WHEN_JSON_PARSE, exception); + throw new ServiceException(exception); + } + } + + /** + *

{@code Json} 反序列化为数组

+ * + * @param json 字符串 + * @param clazz 目标数组类 + * @param 目标类型 + * @return 目标类的实例数组 + */ + public static T[] parseList(String json, Class clazz) { try { return getObjectMapper().readValue(json, clazz); } catch (JsonProcessingException exception) { -- Gitee From f6f3be1ed15166f4f972f6efab6bdbfb1b2b8548 Mon Sep 17 00:00:00 2001 From: Hamm Date: Tue, 9 Jul 2024 21:27:52 +0800 Subject: [PATCH 12/12] =?UTF-8?q?feat(pom.xml):=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E8=87=B32.2.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Hamm --- airpower-core/pom.xml | 4 ++-- pom.xml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/airpower-core/pom.xml b/airpower-core/pom.xml index 1f535f6..095cb6d 100644 --- a/airpower-core/pom.xml +++ b/airpower-core/pom.xml @@ -5,10 +5,10 @@ cn.hamm airpower - 2.2.0 + 2.2.1 airpower-core - 2.2.0 + 2.2.1 airpower-core AirPower is a fast backend development tool based on SpringBoot3 and JPA. It's the core of AirPower. diff --git a/pom.xml b/pom.xml index e36740f..7336c4b 100644 --- a/pom.xml +++ b/pom.xml @@ -4,11 +4,11 @@ 4.0.0 cn.hamm airpower - 2.2.0 + 2.2.1 airpower AirPower is a fast backend development tool based on SpringBoot3 and JPA. - 2.2.0 + 2.2.1 UTF-8 UTF-8 UTF-8 -- Gitee