diff --git a/common/src/main/java/com/huoran/common/utils/TokenUtils.java b/common/src/main/java/com/huoran/common/utils/TokenUtils.java index 6ca1a49..d373c56 100644 --- a/common/src/main/java/com/huoran/common/utils/TokenUtils.java +++ b/common/src/main/java/com/huoran/common/utils/TokenUtils.java @@ -38,6 +38,7 @@ public class TokenUtils { */ public static String getIdByJwtToken(HttpServletRequest request) { String jwtToken = request.getHeader("token"); + System.out.println("------------------------------->>>TOKEN-------------"+jwtToken); if(StringUtils.isEmpty(jwtToken)) { return ""; } diff --git a/competition/src/main/java/com/huoran/competition/controller/CompetitionRegistrationController.java b/competition/src/main/java/com/huoran/competition/controller/CompetitionRegistrationController.java index aa5e47d..c81d64f 100644 --- a/competition/src/main/java/com/huoran/competition/controller/CompetitionRegistrationController.java +++ b/competition/src/main/java/com/huoran/competition/controller/CompetitionRegistrationController.java @@ -9,7 +9,9 @@ import com.huoran.competition.entity.CompetitionRegistration; import com.huoran.competition.entity.req.PageRegistrationStaffReq; import com.huoran.competition.entity.vo.RegistrationNewInformationBroughtOutVO; import com.huoran.competition.entity.vo.RegistrationVO; +import com.huoran.competition.mapper.CompetitionRegistrationMapper; import com.huoran.competition.service.CompetitionRegistrationService; +import com.huoran.competition.service.impl.CompetitionRegistrationServiceImpl; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; @@ -21,6 +23,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.List; +import java.util.stream.Collectors; /** *

@@ -38,6 +41,9 @@ public class CompetitionRegistrationController { @Autowired private CompetitionRegistrationService competitionRegistrationService; + @Autowired + private CompetitionRegistrationMapper competitionRegistrationMapper; + @NoRepeatSubmit @ApiOperation(value = "是否禁用报名人员") @PutMapping("/disableRegistration") @@ -158,21 +164,39 @@ public class CompetitionRegistrationController { if (ObjectUtils.isEmpty(info.getAccountId())) { return R.error("账号id不能为空"); } + //获取原报名信息 + CompetitionRegistration registration = competitionRegistrationService.getById(info.getId()); //判断活动id不能为空 if (ObjectUtils.isEmpty(info.getCompetitionId())) { return R.error("活动id不能为空"); } - //校验是否已经报名活动过 - if (isRegistered(info.getAccountId(), info.getCompetitionId())) { - return R.error("该账号已报名该活动"); + //校验是否已经报名活动过(用于防止该用户本来为个人账号报名了该活动,后认证企业账号后又报名活动,防止通过后台编辑更改当前所属组织架构为个人或组织时候就需判重) + //当前处理方法为:如果当前活动下,用户多个角色下都已参加报名活动,通过后台不能做编辑更改组织的情况 + //如果当前活动下,用户只有一个角色下都已参加报名活动,通过后台可以更改组织的情况 + + List role = competitionRegistrationMapper.getOrganizationalInformation(null, info.getAccountId()); + + if (!ObjectUtils.isEmpty(role)) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + //查询role里面全部accountId + queryWrapper.in("account_id", role.stream().map(RegistrationNewInformationBroughtOutVO::getAccountId).collect(Collectors.toList())); + + List list = competitionRegistrationService.list(queryWrapper); + if (!ObjectUtils.isEmpty(list)){ + return R.error("当前用户已在该角色下报名该活动,请勿重复操作报名!"); + } + } + + boolean flag = true; - //获取原报名信息 - CompetitionRegistration registration = competitionRegistrationService.getById(info.getId()); + if (!ObjectUtils.isEmpty(registration)) { //需求:如果时间被清空情况下,签到状态变更为未签到 if (ObjectUtils.isEmpty(info.getSignInTime())) { registration.setSignInStatus(String.valueOf(2)); + }else if (!ObjectUtils.isEmpty(registration.getSignInTime())){ + registration.setSignInStatus(String.valueOf(1));//有签到时间设置签到状态 } //判断如果账号id不等于原登记的账户id,则账号id做更改 diff --git a/competition/src/main/java/com/huoran/competition/entity/CompetitionRegistration.java b/competition/src/main/java/com/huoran/competition/entity/CompetitionRegistration.java index a504914..ec58334 100644 --- a/competition/src/main/java/com/huoran/competition/entity/CompetitionRegistration.java +++ b/competition/src/main/java/com/huoran/competition/entity/CompetitionRegistration.java @@ -60,7 +60,7 @@ public class CompetitionRegistration implements Serializable { @TableField(fill = FieldFill.INSERT_UPDATE) private Date updateTime; - @ApiModelProperty(value = "签到情况(签到状态(0待签到 1.已签到 2未签到:活动结束后没签到的))") + @ApiModelProperty(value = "签到情况(签到状态(0待签到 1.已签到 2未签到))") private String signInStatus;