活动-用户相关功能

This commit is contained in:
attiya 2025-09-23 10:11:41 +08:00
parent 16e6520546
commit 8cf8e5be32
3 changed files with 4 additions and 16 deletions

View File

@ -115,12 +115,11 @@ public class UserController {
* 用户查询活动详细信息
*
* @param activityId 活动ID
* @param wxOpenId OpenID
* @return 登陆结果
*/
@GetMapping("activity/info")
public JsonResult<?> activityInfo(@NotNull(message = "活动ID不能为空") Long activityId,@NotNull(message = "OpenID不能为空") String wxOpenId) {
ActivityInfo activityInfo = userService.activityInfo(activityId,wxOpenId);
public JsonResult<?> activityInfo(@NotNull(message = "活动ID不能为空") Long activityId) {
ActivityInfo activityInfo = userService.activityInfo(activityId);
return JsonResult.success(activityInfo);
}

View File

@ -18,5 +18,5 @@ public interface UserService extends IService<User> {
void registration(RegistrationVo registrationVo);
ActivityInfo activityInfo(Long activityId, String wxOpenId);
ActivityInfo activityInfo(Long activityId);
}

View File

@ -112,7 +112,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
}
@Override
public ActivityInfo activityInfo(Long activityId, String wxOpenId) {
public ActivityInfo activityInfo(Long activityId) {
QueryWrapper queryWrapper = QueryWrapper.create()
.where(ACTIVITY.ACTIVITY_ID.eq(activityId));
ActivityInfo activityInfo = activityMapper.selectObjectByQueryAs(queryWrapper, ActivityInfo.class);
@ -128,17 +128,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
if (activityInfo.getRegistrationEndTime().isBefore(LocalDateTime.now())) {
activityInfo.setPossibleRegister(Boolean.FALSE);
}
if (activityInfo.getLimitRegister() == 1) {
queryWrapper.clear();
queryWrapper.where(ACTIVITY_USER.ACTIVITY_ID.eq(activityId))
.where(USER.WX_OPEN_ID.eq(wxOpenId))
.leftJoin(USER).on(USER.USER_ID.eq(ACTIVITY_USER.USER_ID));
ActivityUser selected = activityUserMapper.selectOneByQuery(queryWrapper);
if (selected == null) {
activityInfo.setPossibleRegister(Boolean.FALSE);
}
}
return activityInfo;
}
}