fix: 调度页面状态列从后端获取真实状态值

- 在CompetitionGroupDTO中添加status字段(0-未开始,1-进行中,2-已完成)
- 在MartialScheduleServiceImpl中添加calculateGroupStatus方法计算分组状态
- 状态根据参赛人员签到情况自动计算

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
This commit is contained in:
2026-01-16 11:53:56 +08:00
co-authored by factory-droid[bot]
parent 254b22c969
commit 32bde3ae53
2 changed files with 30 additions and 36 deletions
@@ -17,75 +17,42 @@ public class CompetitionGroupDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 分组ID
*/
@Schema(description = "分组ID")
private Long id;
/**
* 项目ID
*/
@Schema(description = "项目ID")
private Long projectId;
/**
* 分组标题
*/
@Schema(description = "分组标题")
private String title;
/**
* 类型:集体/单人/双人
*/
@Schema(description = "类型:集体/单人/双人")
private String type;
/**
* 队伍数量
*/
@Schema(description = "队伍数量")
private String count;
/**
* 分组编号
*/
@Schema(description = "分组编号")
private String code;
/**
* 当前所属场地ID
*/
@Schema(description = "当前所属场地ID")
private Long venueId;
/**
* 场地名称
*/
@Schema(description = "场地名称")
private String venueName;
/**
* 时间段
*/
@Schema(description = "时间段")
private String timeSlot;
/**
* 时间段索引
*/
@Schema(description = "时间段索引")
private Integer timeSlotIndex;
/**
* 预计时长(分钟)
*/
@Schema(description = "预计时长(分钟)")
private Integer estimatedDuration;
/**
* 参赛人员列表
*/
@Schema(description = "状态: 0-未开始, 1-进行中, 2-已完成")
private Integer status;
@Schema(description = "参赛人员列表")
private List<ParticipantDTO> participants;
@@ -262,6 +262,7 @@ public class MartialScheduleServiceImpl extends ServiceImpl<MartialScheduleMappe
.collect(Collectors.toList());
groupDTO.setParticipants(participantDTOs);
groupDTO.setStatus(calculateGroupStatus(participantDTOs));
groupDTOs.add(groupDTO);
}
@@ -405,6 +406,7 @@ public class MartialScheduleServiceImpl extends ServiceImpl<MartialScheduleMappe
}
groupDTO.setParticipants(participantDTOs);
groupDTO.setStatus(calculateGroupStatus(participantDTOs));
groupDTOs.add(groupDTO);
displayOrder++;
}
@@ -459,6 +461,7 @@ public class MartialScheduleServiceImpl extends ServiceImpl<MartialScheduleMappe
}
groupDTO.setParticipants(participantDTOs);
groupDTO.setStatus(calculateGroupStatus(participantDTOs));
return groupDTO;
}
@@ -972,4 +975,28 @@ public class MartialScheduleServiceImpl extends ServiceImpl<MartialScheduleMappe
return result > 0;
}
/**
* Calculate group status based on participants
* @return 0-not started, 1-in progress, 2-completed
*/
private int calculateGroupStatus(List<ParticipantDTO> participants) {
if (participants == null || participants.isEmpty()) {
return 0;
}
boolean allCompleted = true;
boolean anyStarted = false;
for (ParticipantDTO p : participants) {
String s = p.getStatus();
if ("已完成".equals(s) || "已签到".equals(s)) {
anyStarted = true;
} else {
allCompleted = false;
}
}
if (allCompleted && anyStarted) return 2;
if (anyStarted) return 1;
return 0;
}
}