diff --git a/.idea/.cache/.Apifox_Helper/.toolWindow.db b/.idea/.cache/.Apifox_Helper/.toolWindow.db index a0b9b01..3b4bd1f 100644 Binary files a/.idea/.cache/.Apifox_Helper/.toolWindow.db and b/.idea/.cache/.Apifox_Helper/.toolWindow.db differ diff --git a/src/main/java/com/cdzy/activity/component/GlobalExceptionHandler.java b/src/main/java/com/cdzy/activity/component/GlobalExceptionHandler.java index 5596ace..a871b89 100644 --- a/src/main/java/com/cdzy/activity/component/GlobalExceptionHandler.java +++ b/src/main/java/com/cdzy/activity/component/GlobalExceptionHandler.java @@ -1,7 +1,5 @@ package com.cdzy.activity.component; -import cn.dev33.satoken.exception.NotLoginException; -import cn.dev33.satoken.exception.SaTokenException; import com.cdzy.activity.model.JsonResult; import jakarta.servlet.http.HttpServletRequest; import jakarta.validation.ConstraintViolationException; @@ -100,6 +98,20 @@ public class GlobalExceptionHandler { } +// /** +// * 处理其他类型异常 +// * @param request 请求 +// * @param e 异常 +// * @return 结果 +// */ +// @ResponseBody +// @ExceptionHandler +// public JsonResult exp(HttpServletRequest request, Exception e) { +//// LogFactory.getLog(super.getClass()).error(e.getMessage(), e); +// log.error(request.getServletPath(), e); +// return JsonResult.failed("系统内部发生错误,请联系工作人员"); +// } + /** * 处理其他类型异常 * @param request 请求 @@ -111,7 +123,7 @@ public class GlobalExceptionHandler { public JsonResult exp(HttpServletRequest request, Exception e) { // LogFactory.getLog(super.getClass()).error(e.getMessage(), e); log.error(request.getServletPath(), e); - return JsonResult.failed("系统内部发生错误,请联系工作人员"); + return JsonResult.failed(e.getMessage()); } } diff --git a/src/main/java/com/cdzy/activity/service/impl/UserServiceImpl.java b/src/main/java/com/cdzy/activity/service/impl/UserServiceImpl.java index c0a4924..10a1806 100644 --- a/src/main/java/com/cdzy/activity/service/impl/UserServiceImpl.java +++ b/src/main/java/com/cdzy/activity/service/impl/UserServiceImpl.java @@ -104,6 +104,13 @@ public class UserServiceImpl extends ServiceImpl implements Us if (user == null) { throw new RuntimeException("用户信息错误"); } + queryWrapper.clear(); + queryWrapper.where(USER_REGISTRATION_ACTIVITY.USER_ID.eq(user.getUserId())) + .where(USER_REGISTRATION_ACTIVITY.ACTIVITY_ID.eq(activityId)); + UserRegistrationActivity userRegistrationActivity = userRegistrationActivityMapper.selectOneByQuery(queryWrapper); + if (userRegistrationActivity != null) { + throw new RuntimeException("请勿重复报名"); + } UserRegistrationActivity registrationActivity = UserRegistrationActivity.builder() .activityId(activityId) .userId(user.getUserId()) diff --git a/target/classes/com/cdzy/activity/service/impl/UserServiceImpl.class b/target/classes/com/cdzy/activity/service/impl/UserServiceImpl.class index a8c2639..49661f9 100644 Binary files a/target/classes/com/cdzy/activity/service/impl/UserServiceImpl.class and b/target/classes/com/cdzy/activity/service/impl/UserServiceImpl.class differ