|
@@ -24,8 +24,12 @@ import org.dromara.system.domain.bo.ExperienceUpdateInfoBo;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import com.baomidou.lock.annotation.Lock4j;
|
|
import com.baomidou.lock.annotation.Lock4j;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
|
+import org.dromara.system.utils.AthleteCodeUtils;
|
|
|
import org.dromara.system.mapper.*;
|
|
import org.dromara.system.mapper.*;
|
|
|
import org.dromara.system.mapper.app.GameUserMapper;
|
|
import org.dromara.system.mapper.app.GameUserMapper;
|
|
|
|
|
+import org.dromara.common.mybatis.core.page.PageQuery;
|
|
|
|
|
+import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import org.dromara.system.service.app.IUserEventService;
|
|
import org.dromara.system.service.app.IUserEventService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
@@ -365,27 +369,7 @@ public class UserEventServiceImpl implements IUserEventService {
|
|
|
@Override
|
|
@Override
|
|
|
public ExperienceEnrollInfoVo getExperienceEnrollInfo(String phone, Long eventId) {
|
|
public ExperienceEnrollInfoVo getExperienceEnrollInfo(String phone, Long eventId) {
|
|
|
ExperienceEnrollInfoVo infoVo = new ExperienceEnrollInfoVo();
|
|
ExperienceEnrollInfoVo infoVo = new ExperienceEnrollInfoVo();
|
|
|
- // 1. 获取赛事下的项目列表
|
|
|
|
|
- List<GameEventProject> projects = gameEventProjectMapper.selectList(
|
|
|
|
|
- Wrappers.lambdaQuery(GameEventProject.class)
|
|
|
|
|
- .select(GameEventProject::getProjectId, GameEventProject::getProjectName,
|
|
|
|
|
- GameEventProject::getClassification)
|
|
|
|
|
- .eq(GameEventProject::getEventId, eventId)
|
|
|
|
|
- .eq(GameEventProject::getDelFlag, "0")
|
|
|
|
|
- .orderByAsc(GameEventProject::getProjectId));
|
|
|
|
|
- List<ExperienceProjectVo> projectVos = new ArrayList<>();
|
|
|
|
|
- if (CollectionUtils.isNotEmpty(projects)) {
|
|
|
|
|
- for (GameEventProject project : projects) {
|
|
|
|
|
- ExperienceProjectVo pVo = new ExperienceProjectVo();
|
|
|
|
|
- pVo.setProjectId(project.getProjectId());
|
|
|
|
|
- pVo.setProjectName(project.getProjectName());
|
|
|
|
|
- pVo.setClassification(project.getClassification());
|
|
|
|
|
- projectVos.add(pVo);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- infoVo.setProjects(projectVos);
|
|
|
|
|
-
|
|
|
|
|
- // 2. 根据手机号和赛事ID查询是否已经有运动员报名信息
|
|
|
|
|
|
|
+ // 根据手机号和赛事ID查询是否已经有运动员报名信息
|
|
|
GameAthlete athlete = gameAthleteMapper.selectOne(
|
|
GameAthlete athlete = gameAthleteMapper.selectOne(
|
|
|
Wrappers.lambdaQuery(GameAthlete.class)
|
|
Wrappers.lambdaQuery(GameAthlete.class)
|
|
|
.select(GameAthlete::getAthleteId, GameAthlete::getName, GameAthlete::getPhone,
|
|
.select(GameAthlete::getAthleteId, GameAthlete::getName, GameAthlete::getPhone,
|
|
@@ -432,18 +416,18 @@ public class UserEventServiceImpl implements IUserEventService {
|
|
|
// 优先根据传入的 athleteId 查询
|
|
// 优先根据传入的 athleteId 查询
|
|
|
if (submitBo.getAthleteId() != null) {
|
|
if (submitBo.getAthleteId() != null) {
|
|
|
athlete = gameAthleteMapper.selectOne(Wrappers.lambdaQuery(GameAthlete.class)
|
|
athlete = gameAthleteMapper.selectOne(Wrappers.lambdaQuery(GameAthlete.class)
|
|
|
- .select(GameAthlete::getAthleteId, GameAthlete::getName, GameAthlete::getPhone,
|
|
|
|
|
- GameAthlete::getIdCard, GameAthlete::getGender, GameAthlete::getTshirtSize,
|
|
|
|
|
- GameAthlete::getEmergencyContactName, GameAthlete::getEmergencyContactPhone)
|
|
|
|
|
|
|
+ .select(GameAthlete::getAthleteId, GameAthlete::getName, GameAthlete::getPhone,
|
|
|
|
|
+ GameAthlete::getIdCard, GameAthlete::getGender, GameAthlete::getTshirtSize,
|
|
|
|
|
+ GameAthlete::getEmergencyContactName, GameAthlete::getEmergencyContactPhone)
|
|
|
.eq(GameAthlete::getAthleteId, submitBo.getAthleteId())
|
|
.eq(GameAthlete::getAthleteId, submitBo.getAthleteId())
|
|
|
.eq(GameAthlete::getDelFlag, "0"));
|
|
.eq(GameAthlete::getDelFlag, "0"));
|
|
|
}
|
|
}
|
|
|
// 如果没有传入 athleteId 或查不到,则根据手机号和赛事ID查询
|
|
// 如果没有传入 athleteId 或查不到,则根据手机号和赛事ID查询
|
|
|
if (athlete == null) {
|
|
if (athlete == null) {
|
|
|
athlete = gameAthleteMapper.selectOne(Wrappers.lambdaQuery(GameAthlete.class)
|
|
athlete = gameAthleteMapper.selectOne(Wrappers.lambdaQuery(GameAthlete.class)
|
|
|
- .select(GameAthlete::getAthleteId, GameAthlete::getName, GameAthlete::getPhone,
|
|
|
|
|
- GameAthlete::getIdCard, GameAthlete::getGender, GameAthlete::getTshirtSize,
|
|
|
|
|
- GameAthlete::getEmergencyContactName, GameAthlete::getEmergencyContactPhone)
|
|
|
|
|
|
|
+ .select(GameAthlete::getAthleteId, GameAthlete::getName, GameAthlete::getPhone,
|
|
|
|
|
+ GameAthlete::getIdCard, GameAthlete::getGender, GameAthlete::getTshirtSize,
|
|
|
|
|
+ GameAthlete::getEmergencyContactName, GameAthlete::getEmergencyContactPhone)
|
|
|
.eq(GameAthlete::getPhone, submitBo.getPhone().trim())
|
|
.eq(GameAthlete::getPhone, submitBo.getPhone().trim())
|
|
|
.eq(GameAthlete::getEventId, submitBo.getEventId())
|
|
.eq(GameAthlete::getEventId, submitBo.getEventId())
|
|
|
.eq(GameAthlete::getDelFlag, "0"));
|
|
.eq(GameAthlete::getDelFlag, "0"));
|
|
@@ -497,7 +481,8 @@ public class UserEventServiceImpl implements IUserEventService {
|
|
|
.select(GameTeam::getTeamId)
|
|
.select(GameTeam::getTeamId)
|
|
|
.eq(GameTeam::getEventId, submitBo.getEventId())
|
|
.eq(GameTeam::getEventId, submitBo.getEventId())
|
|
|
.eq(GameTeam::getTeamName, submitBo.getTeamName().trim())
|
|
.eq(GameTeam::getTeamName, submitBo.getTeamName().trim())
|
|
|
- .eq(GameTeam::getDelFlag, "0"));
|
|
|
|
|
|
|
+ .eq(GameTeam::getDelFlag, "0")
|
|
|
|
|
+ .last("limit 1"));
|
|
|
|
|
|
|
|
// 找不到匹配的队伍则新建
|
|
// 找不到匹配的队伍则新建
|
|
|
if (team == null) {
|
|
if (team == null) {
|
|
@@ -530,8 +515,8 @@ public class UserEventServiceImpl implements IUserEventService {
|
|
|
|
|
|
|
|
// 5. 校验该赛事每人的项目报名限制数
|
|
// 5. 校验该赛事每人的项目报名限制数
|
|
|
GameEvent event = gameEventMapper.selectOne(Wrappers.lambdaQuery(GameEvent.class)
|
|
GameEvent event = gameEventMapper.selectOne(Wrappers.lambdaQuery(GameEvent.class)
|
|
|
- .select(GameEvent::getEventId, GameEvent::getLimitApplication)
|
|
|
|
|
- .eq(GameEvent::getEventId, submitBo.getEventId()));
|
|
|
|
|
|
|
+ .select(GameEvent::getEventId, GameEvent::getLimitApplication)
|
|
|
|
|
+ .eq(GameEvent::getEventId, submitBo.getEventId()));
|
|
|
if (event == null) {
|
|
if (event == null) {
|
|
|
throw new ServiceException("该赛事不存在或已被删除");
|
|
throw new ServiceException("该赛事不存在或已被删除");
|
|
|
}
|
|
}
|
|
@@ -668,6 +653,8 @@ public class UserEventServiceImpl implements IUserEventService {
|
|
|
athlete.setProjectValue(JSONUtil.toJsonStr(list));
|
|
athlete.setProjectValue(JSONUtil.toJsonStr(list));
|
|
|
boolean success;
|
|
boolean success;
|
|
|
if (isNewAthlete) {
|
|
if (isNewAthlete) {
|
|
|
|
|
+ // 在插入新运动员前,为其生成唯一的运动员编号
|
|
|
|
|
+ athlete.setAthleteCode(AthleteCodeUtils.generateAthleteCode(athlete.getEventId()));
|
|
|
success = gameAthleteMapper.insert(athlete) > 0;
|
|
success = gameAthleteMapper.insert(athlete) > 0;
|
|
|
} else {
|
|
} else {
|
|
|
success = gameAthleteMapper.updateById(athlete) > 0;
|
|
success = gameAthleteMapper.updateById(athlete) > 0;
|
|
@@ -720,4 +707,13 @@ public class UserEventServiceImpl implements IUserEventService {
|
|
|
}
|
|
}
|
|
|
return flag;
|
|
return flag;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public TableDataInfo<ExperienceProjectVo> getExperienceProjectPageList(Long eventId, PageQuery pageQuery) {
|
|
|
|
|
+ if (eventId == null) {
|
|
|
|
|
+ throw new ServiceException("赛事Id不能为空");
|
|
|
|
|
+ }
|
|
|
|
|
+ Page<ExperienceProjectVo> page = gameEventProjectMapper.selectExperienceProjectPage(pageQuery.build(), eventId);
|
|
|
|
|
+ return TableDataInfo.build(page);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|