diff --git a/plusone-basic/plusone-basic-application/src/main/java/xyz/zhouxy/plusone/exception/handler/AllExceptionHandlerConfig.java b/plusone-basic/plusone-basic-application/src/main/java/xyz/zhouxy/plusone/exception/handler/AllExceptionHandlerConfig.java index fd05fdb..ef86397 100644 --- a/plusone-basic/plusone-basic-application/src/main/java/xyz/zhouxy/plusone/exception/handler/AllExceptionHandlerConfig.java +++ b/plusone-basic/plusone-basic-application/src/main/java/xyz/zhouxy/plusone/exception/handler/AllExceptionHandlerConfig.java @@ -1,10 +1,13 @@ package xyz.zhouxy.plusone.exception.handler; +import javax.annotation.Nonnull; + import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import xyz.zhouxy.plusone.exception.handler.BaseExceptionHandler.ExceptionInfoHolder; +import xyz.zhouxy.plusone.commons.exception.handler.AllExceptionHandler; +import xyz.zhouxy.plusone.commons.exception.handler.BaseExceptionHandler.ExceptionInfoHolder; /** * AllExceptionHandlerConfig @@ -14,7 +17,7 @@ import xyz.zhouxy.plusone.exception.handler.BaseExceptionHandler.ExceptionInfoHo public class AllExceptionHandlerConfig { @Bean - AllExceptionHandler getAllExceptionHandler(ExceptionInfoHolder exceptionInfoHolder) { + AllExceptionHandler getAllExceptionHandler(@Nonnull ExceptionInfoHolder exceptionInfoHolder) { return new AllExceptionHandler(exceptionInfoHolder); } } diff --git a/plusone-basic/plusone-basic-application/src/main/java/xyz/zhouxy/plusone/exception/handler/DefaultExceptionHandler.java b/plusone-basic/plusone-basic-application/src/main/java/xyz/zhouxy/plusone/exception/handler/DefaultExceptionHandler.java index aeb8918..6374a97 100644 --- a/plusone-basic/plusone-basic-application/src/main/java/xyz/zhouxy/plusone/exception/handler/DefaultExceptionHandler.java +++ b/plusone-basic/plusone-basic-application/src/main/java/xyz/zhouxy/plusone/exception/handler/DefaultExceptionHandler.java @@ -1,5 +1,7 @@ package xyz.zhouxy.plusone.exception.handler; +import javax.annotation.Nonnull; + import org.springframework.context.support.DefaultMessageSourceResolvable; import org.springframework.core.Ordered; import org.springframework.core.annotation.Order; @@ -11,6 +13,7 @@ import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestControllerAdvice; import lombok.extern.slf4j.Slf4j; +import xyz.zhouxy.plusone.commons.exception.handler.BaseExceptionHandler; import xyz.zhouxy.plusone.commons.util.RestfulResult; /** @@ -40,7 +43,7 @@ import xyz.zhouxy.plusone.commons.util.RestfulResult; @Order(Ordered.LOWEST_PRECEDENCE - 1) @Slf4j public class DefaultExceptionHandler extends BaseExceptionHandler { - public DefaultExceptionHandler(ExceptionInfoHolder exceptionInfoHolder) { + public DefaultExceptionHandler(@Nonnull ExceptionInfoHolder exceptionInfoHolder) { super(exceptionInfoHolder); set(IllegalArgumentException.class, 4010000, "格式错误", HttpStatus.FORBIDDEN); set(DataAccessException.class, 6030000, "数据库错误", HttpStatus.INTERNAL_SERVER_ERROR, true); diff --git a/plusone-basic/plusone-basic-application/src/main/java/xyz/zhouxy/plusone/exception/handler/SysExceptionHandler.java b/plusone-basic/plusone-basic-application/src/main/java/xyz/zhouxy/plusone/exception/handler/SysExceptionHandler.java index b9ad4f6..9fd763f 100644 --- a/plusone-basic/plusone-basic-application/src/main/java/xyz/zhouxy/plusone/exception/handler/SysExceptionHandler.java +++ b/plusone-basic/plusone-basic-application/src/main/java/xyz/zhouxy/plusone/exception/handler/SysExceptionHandler.java @@ -8,6 +8,7 @@ import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestControllerAdvice; import lombok.extern.slf4j.Slf4j; +import xyz.zhouxy.plusone.commons.exception.handler.BaseExceptionHandler; import xyz.zhouxy.plusone.commons.util.RestfulResult; import xyz.zhouxy.plusone.exception.SysException; @@ -15,7 +16,7 @@ import xyz.zhouxy.plusone.exception.SysException; @Slf4j public class SysExceptionHandler extends BaseExceptionHandler { - public SysExceptionHandler(ExceptionInfoHolder exceptionInfoHolder) { + public SysExceptionHandler(@Nonnull ExceptionInfoHolder exceptionInfoHolder) { super(exceptionInfoHolder); } diff --git a/plusone-basic/plusone-basic-common/pom.xml b/plusone-basic/plusone-basic-common/pom.xml index a26bfcb..06a0f90 100644 --- a/plusone-basic/plusone-basic-common/pom.xml +++ b/plusone-basic/plusone-basic-common/pom.xml @@ -49,7 +49,7 @@ xyz.zhouxy.plusone plusone-exception-handler - 0.0.8-SNAPSHOT + 0.0.9-SNAPSHOT diff --git a/plusone-basic/plusone-basic-domain/src/main/java/xyz/zhouxy/plusone/constant/EntityStatus.java b/plusone-basic/plusone-basic-domain/src/main/java/xyz/zhouxy/plusone/constant/EntityStatus.java index 752e31e..d3e887e 100644 --- a/plusone-basic/plusone-basic-domain/src/main/java/xyz/zhouxy/plusone/constant/EntityStatus.java +++ b/plusone-basic/plusone-basic-domain/src/main/java/xyz/zhouxy/plusone/constant/EntityStatus.java @@ -24,12 +24,10 @@ public final class EntityStatus extends Enumeration { private static final ValueSet VALUE_SET = new ValueSet<>( AVAILABLE, DISABLED); - @Nonnull public static EntityStatus of(int id) { return VALUE_SET.get(id); } - @Nonnull public static Collection constants() { return VALUE_SET.getValues(); } diff --git a/plusone-basic/plusone-basic-infrastructure/src/main/java/xyz/zhouxy/plusone/exception/config/PlusoneExceptionHandlerConfig.java b/plusone-basic/plusone-basic-infrastructure/src/main/java/xyz/zhouxy/plusone/exception/config/PlusoneExceptionHandlerConfig.java index fd871aa..ad04f49 100644 --- a/plusone-basic/plusone-basic-infrastructure/src/main/java/xyz/zhouxy/plusone/exception/config/PlusoneExceptionHandlerConfig.java +++ b/plusone-basic/plusone-basic-infrastructure/src/main/java/xyz/zhouxy/plusone/exception/config/PlusoneExceptionHandlerConfig.java @@ -5,7 +5,7 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import xyz.zhouxy.plusone.constant.ErrorCodeConsts; -import xyz.zhouxy.plusone.exception.handler.BaseExceptionHandler.ExceptionInfoHolder; +import xyz.zhouxy.plusone.commons.exception.handler.BaseExceptionHandler.ExceptionInfoHolder; @Configuration public class PlusoneExceptionHandlerConfig { diff --git a/plusone-basic/plusone-basic-infrastructure/src/main/java/xyz/zhouxy/plusone/validator/InvalidInputExceptionHandler.java b/plusone-basic/plusone-basic-infrastructure/src/main/java/xyz/zhouxy/plusone/validator/InvalidInputExceptionHandler.java index 82ebd4e..57c6666 100644 --- a/plusone-basic/plusone-basic-infrastructure/src/main/java/xyz/zhouxy/plusone/validator/InvalidInputExceptionHandler.java +++ b/plusone-basic/plusone-basic-infrastructure/src/main/java/xyz/zhouxy/plusone/validator/InvalidInputExceptionHandler.java @@ -1,13 +1,15 @@ package xyz.zhouxy.plusone.validator; +import javax.annotation.Nonnull; + import org.springframework.web.bind.annotation.RestControllerAdvice; -import xyz.zhouxy.plusone.exception.handler.BaseExceptionHandler; +import xyz.zhouxy.plusone.commons.exception.handler.BaseExceptionHandler; @RestControllerAdvice public class InvalidInputExceptionHandler extends BaseExceptionHandler { - public InvalidInputExceptionHandler(ExceptionInfoHolder exceptionInfoHolder) { + public InvalidInputExceptionHandler(@Nonnull ExceptionInfoHolder exceptionInfoHolder) { super(exceptionInfoHolder); set(InvalidInputException.class, InvalidInputException.ERROR_CODE, "无效的用户输入"); } diff --git a/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/exception/handler/AccountLoginExceptionHandler.java b/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/exception/handler/AccountLoginExceptionHandler.java index bd2a0d5..4f1895b 100644 --- a/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/exception/handler/AccountLoginExceptionHandler.java +++ b/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/exception/handler/AccountLoginExceptionHandler.java @@ -6,14 +6,14 @@ import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestControllerAdvice; -import xyz.zhouxy.plusone.exception.handler.BaseExceptionHandler; import xyz.zhouxy.plusone.system.application.exception.AccountLoginException; +import xyz.zhouxy.plusone.commons.exception.handler.BaseExceptionHandler; import xyz.zhouxy.plusone.commons.util.RestfulResult; @RestControllerAdvice public class AccountLoginExceptionHandler extends BaseExceptionHandler { - public AccountLoginExceptionHandler(ExceptionInfoHolder exceptionInfoHolder) { + public AccountLoginExceptionHandler(@Nonnull ExceptionInfoHolder exceptionInfoHolder) { super(exceptionInfoHolder); } diff --git a/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/exception/handler/SaTokenExceptionHandler.java b/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/exception/handler/SaTokenExceptionHandler.java index a6e0808..0db62bc 100644 --- a/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/exception/handler/SaTokenExceptionHandler.java +++ b/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/exception/handler/SaTokenExceptionHandler.java @@ -1,5 +1,7 @@ package xyz.zhouxy.plusone.system.application.exception.handler; +import javax.annotation.Nonnull; + import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.ExceptionHandler; @@ -14,7 +16,7 @@ import cn.dev33.satoken.exception.NotSafeException; import cn.dev33.satoken.exception.SaTokenException; import cn.dev33.satoken.exception.SameTokenInvalidException; import lombok.extern.slf4j.Slf4j; -import xyz.zhouxy.plusone.exception.handler.BaseExceptionHandler; +import xyz.zhouxy.plusone.commons.exception.handler.BaseExceptionHandler; import xyz.zhouxy.plusone.commons.util.RestfulResult; /** @@ -27,7 +29,7 @@ import xyz.zhouxy.plusone.commons.util.RestfulResult; public class SaTokenExceptionHandler extends BaseExceptionHandler { - public SaTokenExceptionHandler(ExceptionInfoHolder exceptionInfoHolder) { + public SaTokenExceptionHandler(@Nonnull ExceptionInfoHolder exceptionInfoHolder) { super(exceptionInfoHolder); set(NotPermissionException.class, 4030103, "会话未能通过权限认证", HttpStatus.FORBIDDEN); set(NotRoleException.class, 4030103, "会话未能通过角色认证", HttpStatus.FORBIDDEN); diff --git a/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/query/AccountQueries.java b/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/query/AccountQueries.java index e1019e4..fa67800 100644 --- a/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/query/AccountQueries.java +++ b/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/query/AccountQueries.java @@ -2,6 +2,8 @@ package xyz.zhouxy.plusone.system.application.query; import java.util.List; +import javax.annotation.Nonnull; + import org.apache.ibatis.annotations.Mapper; import xyz.zhouxy.plusone.commons.util.PageDTO; @@ -23,6 +25,7 @@ public interface AccountQueries { return PageDTO.of(content, total); } + @Nonnull List queryAccountOverview(AccountQueryParams queryParams); long count(AccountQueryParams queryParams); diff --git a/plusone-system/plusone-system-domain/src/main/java/xyz/zhouxy/plusone/system/domain/model/account/AccountStatus.java b/plusone-system/plusone-system-domain/src/main/java/xyz/zhouxy/plusone/system/domain/model/account/AccountStatus.java index b5e9ba7..540ceab 100644 --- a/plusone-system/plusone-system-domain/src/main/java/xyz/zhouxy/plusone/system/domain/model/account/AccountStatus.java +++ b/plusone-system/plusone-system-domain/src/main/java/xyz/zhouxy/plusone/system/domain/model/account/AccountStatus.java @@ -31,7 +31,6 @@ public final class AccountStatus extends Enumeration implements I return VALUE_SET.get(id); } - @Nonnull public static Collection constants() { return VALUE_SET.getValues(); } diff --git a/plusone-system/plusone-system-domain/src/main/java/xyz/zhouxy/plusone/system/domain/model/account/Sex.java b/plusone-system/plusone-system-domain/src/main/java/xyz/zhouxy/plusone/system/domain/model/account/Sex.java index c8e87e0..09735c5 100644 --- a/plusone-system/plusone-system-domain/src/main/java/xyz/zhouxy/plusone/system/domain/model/account/Sex.java +++ b/plusone-system/plusone-system-domain/src/main/java/xyz/zhouxy/plusone/system/domain/model/account/Sex.java @@ -27,13 +27,11 @@ public final class Sex extends Enumeration implements IValueObject { private static final ValueSet VALUE_SET = new ValueSet<>(UNSET, MALE, FEMALE); - @Nonnull @StaticFactoryMethod(Sex.class) public static Sex of(int value) { return VALUE_SET.get(value); } - @Nonnull public static Collection constants() { return VALUE_SET.getValues(); }