diff --git a/src/main/java/com/guaiguailang/harmony/config/GlobalExceptionHandler.java b/src/main/java/com/guaiguailang/harmony/config/GlobalExceptionHandler.java index b7af2ad..2b2e310 100644 --- a/src/main/java/com/guaiguailang/harmony/config/GlobalExceptionHandler.java +++ b/src/main/java/com/guaiguailang/harmony/config/GlobalExceptionHandler.java @@ -4,6 +4,8 @@ import cn.dev33.satoken.util.SaResult; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestControllerAdvice; +import org.fusesource.jansi.Ansi; +import java.util.Arrays; @RestControllerAdvice @Slf4j @@ -11,8 +13,11 @@ import org.springframework.web.bind.annotation.RestControllerAdvice; public class GlobalExceptionHandler { // 全局异常拦截 @ExceptionHandler - public SaResult handlerException(Exception e) { - log.error(e.getMessage()); - return SaResult.error(e.getMessage()); + public void handlerException(Exception e) { + System.err.println(Ansi.ansi().fgRed().a("==========ERROR==========START==========").reset()); + System.err.println(Ansi.ansi().fgRed().a("错误消息:").a(e.getMessage()).reset()); + System.err.println(Ansi.ansi().fgRed().a("错误类型:").a(e.getLocalizedMessage()).reset()); + System.err.println(Ansi.ansi().fgRed().a(e.getCause() == null ? "" : e.getCause().toString()).reset()); + System.err.println(Ansi.ansi().fgRed().a("==========ERROR========== END ==========").reset()); } } diff --git a/src/main/java/com/guaiguailang/harmony/controller/命名规范.md b/src/main/java/com/guaiguailang/harmony/controller/命名规范.md new file mode 100644 index 0000000..db1c9bf --- /dev/null +++ b/src/main/java/com/guaiguailang/harmony/controller/命名规范.md @@ -0,0 +1,4 @@ + + +比如xxxController,里面的@RequestMapping就写@RequestMapping("/xxx") + diff --git a/src/main/java/com/guaiguailang/harmony/domain/about.txt b/src/main/java/com/guaiguailang/harmony/domain/about.md similarity index 98% rename from src/main/java/com/guaiguailang/harmony/domain/about.txt rename to src/main/java/com/guaiguailang/harmony/domain/about.md index 31df0f2..e561c8f 100644 --- a/src/main/java/com/guaiguailang/harmony/domain/about.txt +++ b/src/main/java/com/guaiguailang/harmony/domain/about.md @@ -1,4 +1,7 @@ domain 文件夹包含了 + entity(持久化对象), 映射数据库数据表的字段 + dto(Data Transfer Object)(数据传输对象), 接收前端参数的对象 + vo(Value Object)(值对象) 响应值对象 \ No newline at end of file diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml index 1683813..b91d791 100644 --- a/src/main/resources/logback-spring.xml +++ b/src/main/resources/logback-spring.xml @@ -1,27 +1,53 @@ - - + + + + + - %d{HH:mm:ss.SSS} [%thread] %-5level 【 %logger{36} 】 %msg%n + %d{HH:mm:ss} %-5level %logger{36} - %msg%n + UTF-8 + + + ERROR + DENY + NEUTRAL + + + ERROR + ACCEPT + DENY + + - logs/app.log + logs/application.log %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + ERROR + DENY + NEUTRAL + + + ERROR + ACCEPT + DENY + + - - - - - + + + \ No newline at end of file