src/main/java/com/ycl/jxkg/config/spring/exception/ExceptionHandle.java
@@ -30,7 +30,9 @@ public class ExceptionHandle { private final static Logger logger = LoggerFactory.getLogger(ExceptionHandle.class); /** 公司项目的包结构,用于缩短错误日志的长度 */ /** * 公司项目的包结构,用于缩短错误日志的长度 */ private final static String COMPANY_PACKAGE = "com.ycl.jxkg."; /** @@ -98,6 +100,7 @@ /** * 打印异常出现位置 * * @param e */ private void printExceptionLocation(Throwable e, HttpServletRequest request, String errMsg) { src/main/java/com/ycl/jxkg/controller/RegisterController.java
@@ -2,6 +2,7 @@ import com.ycl.jxkg.base.Result; import com.ycl.jxkg.domain.form.RegisterForm; import com.ycl.jxkg.service.AuthenticationService; import com.ycl.jxkg.service.UserService; import lombok.RequiredArgsConstructor; import org.springframework.validation.annotation.Validated; @@ -22,15 +23,18 @@ public class RegisterController { private final UserService userService; private final AuthenticationService authenticationService; @PostMapping("/teacher") public Result teacherRegister(@RequestBody @Validated RegisterForm form) { form.setPassword(authenticationService.pwdEncode(form.getPassword())); userService.teacherRegister(form); return Result.ok("注册成功"); } @PostMapping("/student") public Result studentRegister(@RequestBody @Validated RegisterForm form) { form.setPassword(authenticationService.pwdEncode(form.getPassword())); userService.studentRegister(form); return Result.ok("注册成功"); } src/main/java/com/ycl/jxkg/service/impl/UserServiceImpl.java
@@ -31,7 +31,6 @@ private final UserMapper userMapper; private final ApplicationEventPublisher eventPublisher; private final AuthenticationService authenticationService; public List<User> getUsers() { @@ -146,7 +145,6 @@ User teacher = new User(); BeanUtils.copyProperties(form, teacher); teacher.setRole(RoleEnum.ADMIN.getCode()); teacher.setPassword(authenticationService.pwdEncode(form.getPassword())); teacher.setUserUuid(UUID.randomUUID().toString()); teacher.setLastActiveTime(new Date()); teacher.setStatus(UserStatusEnum.Enable.getCode()); @@ -163,7 +161,6 @@ User student = new User(); BeanUtils.copyProperties(form, student); student.setRole(RoleEnum.ADMIN.getCode()); student.setPassword(authenticationService.pwdEncode(form.getPassword())); student.setUserUuid(UUID.randomUUID().toString()); student.setLastActiveTime(new Date()); student.setStatus(UserStatusEnum.Enable.getCode());