diff --git a/.flattened-pom.xml b/.flattened-pom.xml
deleted file mode 100644
index c14d3bc..0000000
--- a/.flattened-pom.xml
+++ /dev/null
@@ -1,176 +0,0 @@
-
-
- 4.0.0
- com.jy
- xiaoyishu
- 0.0.1-SNAPSHOT
- pom
- ${project.artifactId}
- 小壹书(仿小红书),基于 Spring Cloud Alibaba 微服务架构
-
- xiaoyi-auth
- xiaoyi-framework
-
-
- 17
- ${java.version}
- 3.8.1
- 8.0.29
- 3.5.5
- 2.16.1
- 3.0.2
- 1.5.0
- 2022.0.0.0
- 0.0.1-SNAPSHOT
- 2022.0.0
- 1.18.30
- ${java.version}
- UTF-8
- 1.2.21
-
-
-
-
- com.jy
- xiaoyi-common
- 0.0.1-SNAPSHOT
-
-
- com.jy
- xiaoyi-spring-boot-starter-biz-operationlog
- 0.0.1-SNAPSHOT
-
-
- com.jy
- xiaoyi-spring-boot-starter-jackson
- 0.0.1-SNAPSHOT
-
-
- org.springframework.boot
- spring-boot-dependencies
- ${spring-boot.version}
- pom
- import
-
-
- com.alibaba.cloud
- spring-cloud-alibaba-dependencies
- ${spring-cloud-alibaba.version}
- pom
- import
-
-
- org.springframework.cloud
- spring-cloud-dependencies
- ${spring-cloud.version}
- pom
- import
-
-
- org.projectlombok
- lombok
- ${lombok.version}
-
-
- com.fasterxml.jackson.core
- jackson-databind
- ${jackson.version}
-
-
- com.fasterxml.jackson.core
- jackson-core
- ${jackson.version}
-
-
- com.baomidou
- mybatis-plus-boot-starter
- ${mybatis-plus.version}
-
-
- mysql
- mysql-connector-java
- ${mysql-connector-java.version}
-
-
- com.alibaba
- druid-spring-boot-3-starter
- ${druid.version}
-
-
-
-
-
- huaweicloud
- huawei
- https://mirrors.huaweicloud.com/repository/maven/
-
-
- aliyunmaven
- aliyun
- https://maven.aliyun.com/repository/public
-
-
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
- ${spring-boot.version}
-
-
- repackage
-
- repackage
-
-
-
-
-
- maven-compiler-plugin
- ${maven-compiler-plugin.version}
-
- ${java.version}
- ${java.version}
- ${project.build.sourceEncoding}
-
-
- org.projectlombok
- lombok
- ${lombok.version}
-
-
-
-
-
-
-
-
- org.codehaus.mojo
- flatten-maven-plugin
- ${flatten-maven-plugin.version}
-
-
- flatten
- process-resources
-
- flatten
-
-
-
- flatten.clean
- clean
-
- clean
-
-
-
-
- resolveCiFriendliesOnly
- true
-
-
-
-
-
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 5bf7b4b..792af47 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -1,10 +1,11 @@
{
- "maven.executable.options": "-s D:\\Programs\\Dev\\maven\\conf\\settings-aliyun.xml",
+ "maven.executable.options": "-s D:\\Programs\\Dev\\maven\\conf\\settings-aliyun.xml -DskipTests",
"java.format.settings.url": ".vscode/java-formatter.xml",
"java.compile.nullAnalysis.mode": "automatic",
"java.configuration.updateBuildConfiguration": "automatic",
"[java]": {
"editor.tabSize": 4
},
- "maven.executable.path": "D:\\Programs\\Dev\\maven\\bin\\mvn.cmd"
+ "maven.executable.path": "D:\\Programs\\Dev\\maven\\bin\\mvn.cmd",
+ "maven.view": "hierarchical"
}
diff --git a/t b/t
deleted file mode 100644
index e69de29..0000000
diff --git a/xiaoyi-auth/.flattened-pom.xml b/xiaoyi-auth/.flattened-pom.xml
deleted file mode 100644
index 3dbbe9e..0000000
--- a/xiaoyi-auth/.flattened-pom.xml
+++ /dev/null
@@ -1,70 +0,0 @@
-
-
- 4.0.0
-
- com.jy
- xiaoyishu
- 0.0.1-SNAPSHOT
-
- com.jy
- xiaoyi-auth
- 0.0.1-SNAPSHOT
- ${project.artifactId}
- 小壹书:认证服务(负责处理用户登录、注册、账号注销等)
-
-
- com.jy
- xiaoyi-common
-
-
- com.jy
- xiaoyi-spring-boot-starter-biz-operationlog
-
-
- com.jy
- xiaoyi-spring-boot-starter-jackson
-
-
- org.springframework.boot
- spring-boot-starter-web
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
- com.baomidou
- mybatis-plus-boot-starter
-
-
- mysql
- mysql-connector-java
-
-
- com.alibaba
- druid-spring-boot-3-starter
-
-
-
-
-
- false
- src/main/java
-
- **/*.xml
-
-
-
- src/main/resources
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
-
-
diff --git a/xiaoyi-auth/src/main/java/com/jy/xiaoyishu/auth/config/RedisTemplateConfig.java b/xiaoyi-auth/src/main/java/com/jy/xiaoyishu/auth/config/RedisTemplateConfig.java
index ad96868..121b9ce 100644
--- a/xiaoyi-auth/src/main/java/com/jy/xiaoyishu/auth/config/RedisTemplateConfig.java
+++ b/xiaoyi-auth/src/main/java/com/jy/xiaoyishu/auth/config/RedisTemplateConfig.java
@@ -6,6 +6,7 @@ import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;
+import org.springframework.lang.NonNull;
/**
*
@@ -20,7 +21,7 @@ import org.springframework.data.redis.serializer.StringRedisSerializer;
public class RedisTemplateConfig {
@Bean
- public RedisTemplate redisTemplate(RedisConnectionFactory connectionFactory) {
+ public RedisTemplate redisTemplate(@NonNull RedisConnectionFactory connectionFactory) {
RedisTemplate redisTemplate = new RedisTemplate<>();
// 设置 RedisTemplate 的连接工厂
redisTemplate.setConnectionFactory(connectionFactory);
diff --git a/xiaoyi-auth/src/main/java/com/jy/xiaoyishu/auth/controller/TestController.java b/xiaoyi-auth/src/main/java/com/jy/xiaoyishu/auth/controller/TestController.java
index ebef87b..747b9e4 100644
--- a/xiaoyi-auth/src/main/java/com/jy/xiaoyishu/auth/controller/TestController.java
+++ b/xiaoyi-auth/src/main/java/com/jy/xiaoyishu/auth/controller/TestController.java
@@ -1,5 +1,6 @@
package com.jy.xiaoyishu.auth.controller;
+import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@@ -32,7 +33,8 @@ public class TestController {
@PostMapping("/test2")
@ApiOperationLog(description = "测试接口2")
- public Response test2(@RequestBody User user) {
+ public Response test2(@RequestBody @Validated User user) {
+ // int i = 1 / 0;
return Response.success(user);
}
diff --git a/xiaoyi-auth/src/main/java/com/jy/xiaoyishu/auth/enums/ResponseCodeEnum.java b/xiaoyi-auth/src/main/java/com/jy/xiaoyishu/auth/enums/ResponseCodeEnum.java
new file mode 100644
index 0000000..e6b6096
--- /dev/null
+++ b/xiaoyi-auth/src/main/java/com/jy/xiaoyishu/auth/enums/ResponseCodeEnum.java
@@ -0,0 +1,31 @@
+package com.jy.xiaoyishu.auth.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import java.lang.String;
+
+import com.jy.framework.common.exception.BaseExceptionInterface;
+
+/**
+ *
+ * @author ayi
+ * @version V1.0
+ * @title ResponseCodeEnum
+ * @description 响应码枚举类
+ * @date 2026/01/15 14:37
+ */
+@Getter
+@AllArgsConstructor
+public enum ResponseCodeEnum implements BaseExceptionInterface {
+ // -------- 通用异常状态码 --------
+ SYSTEM_ERROR("AUTH-10000", "系统错误"), PARAM_NOT_VALID("AUTH-10001", "参数错误");
+
+ /**
+ * 错误码
+ */
+ private final String errorCode;
+ /**
+ * 错误信息
+ */
+ private final String errorMessage;
+}
diff --git a/xiaoyi-auth/src/main/java/com/jy/xiaoyishu/auth/exception/GlobalExceptionHandler.java b/xiaoyi-auth/src/main/java/com/jy/xiaoyishu/auth/exception/GlobalExceptionHandler.java
new file mode 100644
index 0000000..34111b1
--- /dev/null
+++ b/xiaoyi-auth/src/main/java/com/jy/xiaoyishu/auth/exception/GlobalExceptionHandler.java
@@ -0,0 +1,85 @@
+package com.jy.xiaoyishu.auth.exception;
+
+import java.util.Optional;
+
+import org.springframework.validation.BindingResult;
+import org.springframework.web.bind.MethodArgumentNotValidException;
+import org.springframework.web.bind.annotation.ControllerAdvice;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import com.jy.framework.common.exception.BizException;
+import com.jy.framework.common.response.Response;
+import com.jy.xiaoyishu.auth.enums.ResponseCodeEnum;
+
+import jakarta.servlet.http.HttpServletRequest;
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+@ControllerAdvice
+public class GlobalExceptionHandler {
+
+ /**
+ * 捕获自定义业务异常
+ *
+ * @param request 请求
+ * @param e 异常
+ * @return 响应结果
+ */
+ @ExceptionHandler({BizException.class})
+ @ResponseBody
+ public Response