Merge branch 'main' of git.waypeak.work:martial/martial-master
This commit is contained in:
@@ -22,6 +22,7 @@ import org.springblade.modules.martial.pojo.vo.MiniScoreDetailVO;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import org.springblade.modules.martial.service.*;
|
||||
import org.springblade.modules.martial.pojo.entity.MtVenue;
|
||||
import org.springblade.modules.martial.pojo.entity.MartialVenue;
|
||||
import org.springblade.core.redis.cache.BladeRedis;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -103,10 +104,10 @@ public class MartialMiniController extends BladeController {
|
||||
invite.setDeviceInfo(dto.getDeviceInfo());
|
||||
judgeInviteService.updateById(invite);
|
||||
|
||||
// 从 mt_venue 表获取场地信息
|
||||
MtVenue mtVenue = null;
|
||||
// 从 martial_venue 表获取场地信息
|
||||
MartialVenue martialVenue = null;
|
||||
if (invite.getVenueId() != null) {
|
||||
mtVenue = mtVenueService.getById(invite.getVenueId());
|
||||
martialVenue = venueService.getById(invite.getVenueId());
|
||||
}
|
||||
|
||||
List<MiniLoginVO.ProjectInfo> projects = parseProjects(invite.getProjects());
|
||||
@@ -120,8 +121,8 @@ public class MartialMiniController extends BladeController {
|
||||
competition.getCompetitionStartTime().toString() : "");
|
||||
vo.setJudgeId(judge.getId());
|
||||
vo.setJudgeName(judge.getName());
|
||||
vo.setVenueId(mtVenue != null ? mtVenue.getId() : null);
|
||||
vo.setVenueName(mtVenue != null ? mtVenue.getVenueName() : null);
|
||||
vo.setVenueId(martialVenue != null ? martialVenue.getId() : null);
|
||||
vo.setVenueName(martialVenue != null ? martialVenue.getVenueName() : null);
|
||||
vo.setProjects(projects);
|
||||
|
||||
// 将登录信息缓存到Redis(服务重启后仍然有效)
|
||||
@@ -192,7 +193,7 @@ public class MartialMiniController extends BladeController {
|
||||
private void updateAthleteTotalScore(Long athleteId, Long projectId, Long venueId) {
|
||||
try {
|
||||
// 1. 查询该场地的普通裁判数量
|
||||
int requiredJudgeCount = getRequiredJudgeCount(venueId);
|
||||
int requiredJudgeCount = getRequiredJudgeCount(projectId);
|
||||
|
||||
// 2. 获取裁判长ID列表
|
||||
List<Long> chiefJudgeIds = getChiefJudgeIds(venueId);
|
||||
@@ -242,17 +243,18 @@ public class MartialMiniController extends BladeController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取场地应评分的裁判数量(普通裁判,不包括裁判长)
|
||||
* 注意:使用 DISTINCT judge_id 来避免重复计数
|
||||
* 获取项目应评分的裁判数量(普通裁判,不包括裁判长)
|
||||
* 按项目过滤:检查 projects JSON 字段是否包含该项目ID
|
||||
*/
|
||||
private int getRequiredJudgeCount(Long venueId) {
|
||||
if (venueId == null) {
|
||||
private int getRequiredJudgeCount(Long projectId) {
|
||||
if (projectId == null) {
|
||||
return 0;
|
||||
}
|
||||
LambdaQueryWrapper<MartialJudgeInvite> judgeQuery = new LambdaQueryWrapper<>();
|
||||
judgeQuery.eq(MartialJudgeInvite::getVenueId, venueId);
|
||||
judgeQuery.eq(MartialJudgeInvite::getIsDeleted, 0);
|
||||
judgeQuery.ne(MartialJudgeInvite::getRole, "chief_judge"); // 排除裁判长
|
||||
// 按项目过滤:projects字段包含该项目ID
|
||||
judgeQuery.like(MartialJudgeInvite::getProjects, projectId.toString());
|
||||
List<MartialJudgeInvite> judges = judgeInviteService.list(judgeQuery);
|
||||
// 使用 distinct judge_id 来计算不重复的裁判数量
|
||||
return (int) judges.stream()
|
||||
@@ -351,7 +353,7 @@ public class MartialMiniController extends BladeController {
|
||||
scoreQuery.eq(MartialScore::getProjectId, projectId);
|
||||
}
|
||||
// 添加场地过滤
|
||||
if (venueId != null) {
|
||||
if (venueId != null && venueId > 0) {
|
||||
scoreQuery.eq(MartialScore::getVenueId, venueId);
|
||||
}
|
||||
// 排除裁判长的评分
|
||||
@@ -365,7 +367,7 @@ public class MartialMiniController extends BladeController {
|
||||
.collect(java.util.stream.Collectors.groupingBy(MartialScore::getAthleteId));
|
||||
|
||||
// 4. 获取该场地的应评裁判数量
|
||||
int requiredJudgeCount = getRequiredJudgeCount(venueId);
|
||||
int requiredJudgeCount = getRequiredJudgeCount(projectId);
|
||||
|
||||
// 5. 根据裁判类型处理选手列表
|
||||
List<org.springblade.modules.martial.pojo.vo.MiniAthleteListVO> filteredList;
|
||||
@@ -490,7 +492,7 @@ public class MartialMiniController extends BladeController {
|
||||
// 重建登录信息
|
||||
MartialCompetition competition = competitionService.getById(invite.getCompetitionId());
|
||||
MartialJudge judge = judgeService.getById(invite.getJudgeId());
|
||||
MtVenue mtVenue = invite.getVenueId() != null ? mtVenueService.getById(invite.getVenueId()) : null;
|
||||
MartialVenue martialVenue = invite.getVenueId() != null ? venueService.getById(invite.getVenueId()) : null;
|
||||
List<MiniLoginVO.ProjectInfo> projects = parseProjects(invite.getProjects());
|
||||
|
||||
MiniLoginVO vo = new MiniLoginVO();
|
||||
@@ -502,8 +504,8 @@ public class MartialMiniController extends BladeController {
|
||||
competition.getCompetitionStartTime().toString() : "");
|
||||
vo.setJudgeId(judge != null ? judge.getId() : null);
|
||||
vo.setJudgeName(judge != null ? judge.getName() : null);
|
||||
vo.setVenueId(mtVenue != null ? mtVenue.getId() : null);
|
||||
vo.setVenueName(mtVenue != null ? mtVenue.getVenueName() : null);
|
||||
vo.setVenueId(martialVenue != null ? martialVenue.getId() : null);
|
||||
vo.setVenueName(martialVenue != null ? martialVenue.getVenueName() : null);
|
||||
vo.setProjects(projects);
|
||||
|
||||
// 重新缓存到Redis
|
||||
|
||||
Reference in New Issue
Block a user