fix(mini): 根据场地获取项目列表,解决同一项目显示在多个场地的问题
- 在MartialProject实体添加venueId字段 - 数据库martial_project表添加venue_id列 - 修改MartialMiniController:当裁判未指定项目时,根据venue_id获取该场地的项目 - 新增getProjectsByVenue方法 Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -114,14 +114,19 @@ public class MartialMiniController extends BladeController {
|
|||||||
martialVenue = venueService.getById(invite.getVenueId());
|
martialVenue = venueService.getById(invite.getVenueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取项目列表:如果邀请记录中有指定项目则使用,否则获取该比赛的所有项目
|
// 获取项目列表:如果邀请记录中有指定项目则使用,否则根据场地获取项目
|
||||||
List<MiniLoginVO.ProjectInfo> projects;
|
List<MiniLoginVO.ProjectInfo> projects;
|
||||||
if (Func.isNotEmpty(invite.getProjects())) {
|
if (Func.isNotEmpty(invite.getProjects())) {
|
||||||
projects = parseProjects(invite.getProjects());
|
projects = parseProjects(invite.getProjects());
|
||||||
} else {
|
} else {
|
||||||
// 未指定项目,获取该比赛的所有项目(裁判负责整个场地)
|
// 未指定项目,根据场地获取项目;如果没有场地则获取所有项目
|
||||||
|
if (invite.getVenueId() != null) {
|
||||||
|
projects = getProjectsByVenue(invite.getVenueId());
|
||||||
|
} else {
|
||||||
|
// 总裁或未分配场地的裁判,获取所有项目
|
||||||
projects = getAllProjectsByCompetition(competition.getId());
|
projects = getAllProjectsByCompetition(competition.getId());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MiniLoginVO vo = new MiniLoginVO();
|
MiniLoginVO vo = new MiniLoginVO();
|
||||||
vo.setToken(token);
|
vo.setToken(token);
|
||||||
@@ -517,14 +522,19 @@ public class MartialMiniController extends BladeController {
|
|||||||
MartialCompetition competition = competitionService.getById(invite.getCompetitionId());
|
MartialCompetition competition = competitionService.getById(invite.getCompetitionId());
|
||||||
MartialJudge judge = judgeService.getById(invite.getJudgeId());
|
MartialJudge judge = judgeService.getById(invite.getJudgeId());
|
||||||
MartialVenue martialVenue = invite.getVenueId() != null ? venueService.getById(invite.getVenueId()) : null;
|
MartialVenue martialVenue = invite.getVenueId() != null ? venueService.getById(invite.getVenueId()) : null;
|
||||||
// 获取项目列表:如果邀请记录中有指定项目则使用,否则获取该比赛的所有项目
|
// 获取项目列表:如果邀请记录中有指定项目则使用,否则根据场地获取项目
|
||||||
List<MiniLoginVO.ProjectInfo> projects;
|
List<MiniLoginVO.ProjectInfo> projects;
|
||||||
if (Func.isNotEmpty(invite.getProjects())) {
|
if (Func.isNotEmpty(invite.getProjects())) {
|
||||||
projects = parseProjects(invite.getProjects());
|
projects = parseProjects(invite.getProjects());
|
||||||
} else {
|
} else {
|
||||||
// 未指定项目,获取该比赛的所有项目(裁判负责整个场地)
|
// 未指定项目,根据场地获取项目;如果没有场地则获取所有项目
|
||||||
|
if (invite.getVenueId() != null) {
|
||||||
|
projects = getProjectsByVenue(invite.getVenueId());
|
||||||
|
} else {
|
||||||
|
// 总裁或未分配场地的裁判,获取所有项目
|
||||||
projects = getAllProjectsByCompetition(competition.getId());
|
projects = getAllProjectsByCompetition(competition.getId());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MiniLoginVO vo = new MiniLoginVO();
|
MiniLoginVO vo = new MiniLoginVO();
|
||||||
vo.setToken(token);
|
vo.setToken(token);
|
||||||
@@ -698,6 +708,30 @@ public class MartialMiniController extends BladeController {
|
|||||||
return projects;
|
return projects;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据场地获取项目列表
|
||||||
|
*/
|
||||||
|
private List<MiniLoginVO.ProjectInfo> getProjectsByVenue(Long venueId) {
|
||||||
|
List<MiniLoginVO.ProjectInfo> projects = new ArrayList<>();
|
||||||
|
|
||||||
|
LambdaQueryWrapper<MartialProject> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(MartialProject::getVenueId, venueId);
|
||||||
|
wrapper.eq(MartialProject::getIsDeleted, 0);
|
||||||
|
|
||||||
|
List<MartialProject> projectList = projectService.list(wrapper);
|
||||||
|
|
||||||
|
if (Func.isNotEmpty(projectList)) {
|
||||||
|
projects = projectList.stream().map(project -> {
|
||||||
|
MiniLoginVO.ProjectInfo info = new MiniLoginVO.ProjectInfo();
|
||||||
|
info.setProjectId(project.getId());
|
||||||
|
info.setProjectName(project.getProjectName());
|
||||||
|
return info;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
return projects;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ========== 三级裁判评分流程 API ==========
|
// ========== 三级裁判评分流程 API ==========
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,12 @@ public class MartialProject extends TenantEntity {
|
|||||||
@Schema(description = "赛事ID")
|
@Schema(description = "赛事ID")
|
||||||
private Long competitionId;
|
private Long competitionId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所属场地ID
|
||||||
|
*/
|
||||||
|
@Schema(description = "所属场地ID")
|
||||||
|
private Long venueId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目名称
|
* 项目名称
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user