出场顺序:显示预计出场时间和评分完成状态
- LineupParticipantVO添加estimatedTime字段 - 根据出场顺序计算预计出场时间(每人5分钟) - 根据martial_result.score_status判断已完成状态 Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
This commit is contained in:
+29
-1
@@ -938,6 +938,15 @@ public class MartialMiniController extends BladeController {
|
||||
|
||||
// 使用现有mapper查询编排详情
|
||||
List<ScheduleGroupDetailVO> details = scheduleGroupMapper.selectScheduleGroupDetails(competitionId);
|
||||
// 查询已完成评分的选手ID(主裁判已确认)
|
||||
LambdaQueryWrapper<MartialResult> resultWrapper = new LambdaQueryWrapper<>();
|
||||
resultWrapper.eq(MartialResult::getCompetitionId, competitionId)
|
||||
.eq(MartialResult::getScoreStatus, 1) // 主裁判已确认
|
||||
.eq(MartialResult::getIsDeleted, 0);
|
||||
List<MartialResult> completedResults = resultService.list(resultWrapper);
|
||||
Set<Long> completedAthleteIds = completedResults.stream()
|
||||
.map(MartialResult::getAthleteId)
|
||||
.collect(Collectors.toSet());
|
||||
System.out.println("details count: " + (details != null ? details.size() : 0));
|
||||
if (details != null && !details.isEmpty()) {
|
||||
System.out.println("first detail participantId: " + details.get(0).getParticipantId());
|
||||
@@ -984,7 +993,26 @@ public class MartialMiniController extends BladeController {
|
||||
participant.setPlayerName(detail.getPlayerName());
|
||||
participant.setOrganization(detail.getOrganization());
|
||||
participant.setIsMe(myAthleteIds.contains(detail.getParticipantId()));
|
||||
participant.setStatus(detail.getScheduleStatus() != null ? detail.getScheduleStatus() : "waiting");
|
||||
// 根据评分状态判断:已完成 > 进行中 > 待出场
|
||||
if (completedAthleteIds.contains(detail.getParticipantId())) {
|
||||
participant.setStatus("已完成");
|
||||
} else {
|
||||
participant.setStatus("待出场");
|
||||
}
|
||||
// 计算预计出场时间
|
||||
String baseTime = detail.getTimeSlot() != null ? detail.getTimeSlot() : "08:00";
|
||||
int orderNum = participant.getOrder() != null ? participant.getOrder() : 1;
|
||||
int minutesOffset = (orderNum - 1) * 5; // 每人5分钟
|
||||
try {
|
||||
String[] parts = baseTime.split(":");
|
||||
int hours = Integer.parseInt(parts[0]);
|
||||
int minutes = Integer.parseInt(parts[1]) + minutesOffset;
|
||||
hours += minutes / 60;
|
||||
minutes = minutes % 60;
|
||||
participant.setEstimatedTime(String.format("%02d:%02d", hours, minutes));
|
||||
} catch (Exception e) {
|
||||
participant.setEstimatedTime(baseTime);
|
||||
}
|
||||
group.getParticipants().add(participant);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,5 +15,6 @@ public class LineupParticipantVO implements Serializable {
|
||||
private String playerName;
|
||||
private String organization;
|
||||
private String status;
|
||||
private Boolean isMe; // 是否为当前用户
|
||||
private String estimatedTime;
|
||||
private Boolean isMe;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user