|
|
@ -39,7 +39,6 @@ import com.epmet.dto.ActUserRelationDTO; |
|
|
|
import com.epmet.dto.form.resi.ResiActRegistrationFormDTO; |
|
|
|
import com.epmet.dto.form.resi.ResiActUserCancelSignUpFormDTO; |
|
|
|
import com.epmet.dto.result.UserRoleResultDTO; |
|
|
|
import com.epmet.dto.result.resi.ResiActRegistrationResultDTO; |
|
|
|
import com.epmet.entity.ActUserLogEntity; |
|
|
|
import com.epmet.entity.ActUserRelationEntity; |
|
|
|
import com.epmet.entity.HeartUserInfoEntity; |
|
|
@ -48,6 +47,7 @@ import com.epmet.redis.ActUserRelationRedis; |
|
|
|
import com.epmet.service.ActInfoService; |
|
|
|
import com.epmet.service.ActUserLogService; |
|
|
|
import com.epmet.service.ActUserRelationService; |
|
|
|
import com.epmet.utils.ModuleConstant; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.logging.log4j.LogManager; |
|
|
|
import org.apache.logging.log4j.Logger; |
|
|
@ -195,46 +195,40 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public Result<ResiActRegistrationResultDTO> registration(TokenDto tokenDto, ResiActRegistrationFormDTO formDTO) { |
|
|
|
public Result registration(TokenDto tokenDto, ResiActRegistrationFormDTO formDTO) { |
|
|
|
formDTO.setUserId(tokenDto.getUserId()); |
|
|
|
boolean satisfy = false; |
|
|
|
ResiActRegistrationResultDTO resultDTO = new ResiActRegistrationResultDTO(); |
|
|
|
|
|
|
|
// 查询活动信息
|
|
|
|
ActInfoDTO actInfoDTO = actInfoService.get(formDTO.getActId()); |
|
|
|
// >0 当前用户是志愿者
|
|
|
|
Integer volunteerFlag = volunteerInfoDao.queryVolunteerFlagByUserId(formDTO.getUserId()); |
|
|
|
if (actInfoDTO.getVolunteerLimit()){ |
|
|
|
// 活动只能志愿者参加, 当前用户是否满足条件
|
|
|
|
satisfy = this.volunteerParticipationAct(volunteerFlag); |
|
|
|
if (!satisfy){ |
|
|
|
logger.info(EpmetErrorCode.NON_CERTIFIED_VOLUNTEER.getMsg()); |
|
|
|
resultDTO.setFlag(EpmetErrorCode.NON_CERTIFIED_VOLUNTEER.getCode()); |
|
|
|
resultDTO.setTip(EpmetErrorCode.NON_CERTIFIED_VOLUNTEER.getMsg()); |
|
|
|
return new Result<ResiActRegistrationResultDTO>().ok(resultDTO); |
|
|
|
} |
|
|
|
if (NumConstant.ZERO < volunteerFlag){ |
|
|
|
// 志愿者身份,可参加所有活动
|
|
|
|
satisfy = true; |
|
|
|
} else { |
|
|
|
// 活动不限制志愿者身份,但要求是 居民身份, 当前用户是否满足条件
|
|
|
|
satisfy = this.resiParticipationAct(formDTO.getUserId()); |
|
|
|
if (!satisfy){ |
|
|
|
logger.info(EpmetErrorCode.CANNOT_AUDIT_WARM.getMsg()); |
|
|
|
resultDTO.setFlag(EpmetErrorCode.CANNOT_AUDIT_WARM.getCode()); |
|
|
|
resultDTO.setTip(EpmetErrorCode.CANNOT_AUDIT_WARM.getMsg()); |
|
|
|
return new Result<ResiActRegistrationResultDTO>().ok(resultDTO); |
|
|
|
// 如果用户不是志愿者,则需判断,当前活动 非志愿者是非可报名
|
|
|
|
if (actInfoDTO.getVolunteerLimit()){ |
|
|
|
// 活动只能志愿者参加, 当前用户是否满足条件
|
|
|
|
satisfy = this.volunteerParticipationAct(volunteerFlag); |
|
|
|
} else { |
|
|
|
// 活动不限制志愿者身份,但要求是 居民身份, 当前用户是否满足条件
|
|
|
|
satisfy = this.resiParticipationAct(formDTO.getUserId()); |
|
|
|
} |
|
|
|
} |
|
|
|
if (satisfy){ |
|
|
|
// 开始报名
|
|
|
|
boolean actTimeConflict = this.actStartSignUp(actInfoDTO, formDTO, volunteerFlag); |
|
|
|
if (!actTimeConflict){ |
|
|
|
logger.info(EpmetErrorCode.ACT_TIME_CONFLICT.getMsg()); |
|
|
|
resultDTO.setFlag(EpmetErrorCode.ACT_TIME_CONFLICT.getCode()); |
|
|
|
resultDTO.setTip(EpmetErrorCode.ACT_TIME_CONFLICT.getMsg()); |
|
|
|
return new Result<ResiActRegistrationResultDTO>().ok(resultDTO); |
|
|
|
logger.info(EpmetErrorCode.ACT_TIME_CONFLICT); |
|
|
|
throw new RenException(EpmetErrorCode.ACT_TIME_CONFLICT.getCode()); |
|
|
|
} |
|
|
|
} else { |
|
|
|
// 不满足,提示用户去认证志愿者
|
|
|
|
logger.info(EpmetErrorCode.NON_CERTIFIED_VOLUNTEER); |
|
|
|
throw new RenException(EpmetErrorCode.NON_CERTIFIED_VOLUNTEER.getCode()); |
|
|
|
} |
|
|
|
resultDTO.setFlag(EpmetErrorCode.ACT_REGISTRATION_SUCCESS.getCode()); |
|
|
|
resultDTO.setTip(EpmetErrorCode.ACT_REGISTRATION_SUCCESS.getMsg()); |
|
|
|
return new Result<ResiActRegistrationResultDTO>().ok(resultDTO); |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|