|
|
|
@ -1,6 +1,7 @@ |
|
|
|
|
package com.huoran.competition.controller; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.huoran.common.aop.annotation.NoRepeatSubmit; |
|
|
|
|
import com.huoran.common.response.R; |
|
|
|
|
import com.huoran.common.utils.TokenUtils; |
|
|
|
@ -115,19 +116,35 @@ public class CompetitionRegistrationController { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//校验是否已经报名活动
|
|
|
|
|
public boolean isRegistered(Integer accountId, Integer competitionId) { |
|
|
|
|
|
|
|
|
|
QueryWrapper<CompetitionRegistration> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
queryWrapper.eq("account_id", accountId); |
|
|
|
|
queryWrapper.eq("competition_id", competitionId); |
|
|
|
|
CompetitionRegistration competitionRegistration = competitionRegistrationService.getOne(queryWrapper); |
|
|
|
|
return competitionRegistration != null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "后台-新增报名人员(这里的账号id必传,根据手机号带出的账号信息选中)") |
|
|
|
|
@PostMapping("/addNewApplicantsInTheBackground") |
|
|
|
|
public R addNewApplicantsInTheBackground(@ApiParam(name = "competitionRegistration", value = "报名人员对象", required = true) @RequestBody CompetitionRegistration competitionRegistration) { |
|
|
|
|
if (ObjectUtils.isEmpty(competitionRegistration.getAccountId())) { |
|
|
|
|
return R.error("账号id不能为空"); |
|
|
|
|
} |
|
|
|
|
//校验是否已经报名活动过
|
|
|
|
|
if (isRegistered(competitionRegistration.getAccountId(), competitionRegistration.getCompetitionId())) { |
|
|
|
|
return R.error("该账号已报名该活动"); |
|
|
|
|
} |
|
|
|
|
boolean flag = competitionRegistrationService.save(competitionRegistration); |
|
|
|
|
return flag ? R.ok() : R.error("新增失败"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "后台-报名人员详情(必填,列表返回的账号id)", response = RegistrationNewInformationBroughtOutVO.class) |
|
|
|
|
@PostMapping("/detailsOfApplicants") |
|
|
|
|
public R detailsOfApplicants(@ApiParam(name = "accountId", value = "账号id(列表返回的账号id)", required = true) @RequestParam("accountId") Integer accountId, @ApiParam(name = "competitionId", value = "活动id", required = true) @RequestParam("accountId") String competitionId) { |
|
|
|
|
public R detailsOfApplicants(@ApiParam(name = "accountId", value = "账号id(列表返回的账号id)", required = true) @RequestParam("accountId") Integer accountId, |
|
|
|
|
@ApiParam(name = "competitionId", value = "活动id", required = true) @RequestParam("competitionId") String competitionId) { |
|
|
|
|
if (ObjectUtils.isEmpty(accountId)) { |
|
|
|
|
return R.error("账号id不能为空"); |
|
|
|
|
} |
|
|
|
@ -145,6 +162,10 @@ public class CompetitionRegistrationController { |
|
|
|
|
if (ObjectUtils.isEmpty(info.getCompetitionId())) { |
|
|
|
|
return R.error("活动id不能为空"); |
|
|
|
|
} |
|
|
|
|
//校验是否已经报名活动过
|
|
|
|
|
if (isRegistered(info.getAccountId(), info.getCompetitionId())) { |
|
|
|
|
return R.error("该账号已报名该活动"); |
|
|
|
|
} |
|
|
|
|
boolean flag = true; |
|
|
|
|
//获取原报名信息
|
|
|
|
|
CompetitionRegistration registration = competitionRegistrationService.getById(info.getId()); |
|
|
|
|