Compare commits
3
Commits
254b22c969
...
af513ce83a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
af513ce83a | ||
|
|
33819a362d | ||
|
|
32bde3ae53 |
@@ -17,75 +17,42 @@ public class CompetitionGroupDTO implements Serializable {
|
|||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
|
||||||
* 分组ID
|
|
||||||
*/
|
|
||||||
@Schema(description = "分组ID")
|
@Schema(description = "分组ID")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
|
||||||
* 项目ID
|
|
||||||
*/
|
|
||||||
@Schema(description = "项目ID")
|
@Schema(description = "项目ID")
|
||||||
private Long projectId;
|
private Long projectId;
|
||||||
|
|
||||||
/**
|
|
||||||
* 分组标题
|
|
||||||
*/
|
|
||||||
@Schema(description = "分组标题")
|
@Schema(description = "分组标题")
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
/**
|
|
||||||
* 类型:集体/单人/双人
|
|
||||||
*/
|
|
||||||
@Schema(description = "类型:集体/单人/双人")
|
@Schema(description = "类型:集体/单人/双人")
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
/**
|
|
||||||
* 队伍数量
|
|
||||||
*/
|
|
||||||
@Schema(description = "队伍数量")
|
@Schema(description = "队伍数量")
|
||||||
private String count;
|
private String count;
|
||||||
|
|
||||||
/**
|
|
||||||
* 分组编号
|
|
||||||
*/
|
|
||||||
@Schema(description = "分组编号")
|
@Schema(description = "分组编号")
|
||||||
private String code;
|
private String code;
|
||||||
|
|
||||||
/**
|
|
||||||
* 当前所属场地ID
|
|
||||||
*/
|
|
||||||
@Schema(description = "当前所属场地ID")
|
@Schema(description = "当前所属场地ID")
|
||||||
private Long venueId;
|
private Long venueId;
|
||||||
|
|
||||||
/**
|
|
||||||
* 场地名称
|
|
||||||
*/
|
|
||||||
@Schema(description = "场地名称")
|
@Schema(description = "场地名称")
|
||||||
private String venueName;
|
private String venueName;
|
||||||
|
|
||||||
/**
|
|
||||||
* 时间段
|
|
||||||
*/
|
|
||||||
@Schema(description = "时间段")
|
@Schema(description = "时间段")
|
||||||
private String timeSlot;
|
private String timeSlot;
|
||||||
|
|
||||||
/**
|
|
||||||
* 时间段索引
|
|
||||||
*/
|
|
||||||
@Schema(description = "时间段索引")
|
@Schema(description = "时间段索引")
|
||||||
private Integer timeSlotIndex;
|
private Integer timeSlotIndex;
|
||||||
|
|
||||||
/**
|
|
||||||
* 预计时长(分钟)
|
|
||||||
*/
|
|
||||||
@Schema(description = "预计时长(分钟)")
|
@Schema(description = "预计时长(分钟)")
|
||||||
private Integer estimatedDuration;
|
private Integer estimatedDuration;
|
||||||
|
|
||||||
/**
|
@Schema(description = "状态: 0-未开始, 1-进行中, 2-已完成")
|
||||||
* 参赛人员列表
|
private Integer status;
|
||||||
*/
|
|
||||||
@Schema(description = "参赛人员列表")
|
@Schema(description = "参赛人员列表")
|
||||||
private List<ParticipantDTO> participants;
|
private List<ParticipantDTO> participants;
|
||||||
|
|
||||||
|
|||||||
+27
@@ -262,6 +262,7 @@ public class MartialScheduleServiceImpl extends ServiceImpl<MartialScheduleMappe
|
|||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
groupDTO.setParticipants(participantDTOs);
|
groupDTO.setParticipants(participantDTOs);
|
||||||
|
groupDTO.setStatus(calculateGroupStatus(participantDTOs));
|
||||||
groupDTOs.add(groupDTO);
|
groupDTOs.add(groupDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -405,6 +406,7 @@ public class MartialScheduleServiceImpl extends ServiceImpl<MartialScheduleMappe
|
|||||||
}
|
}
|
||||||
|
|
||||||
groupDTO.setParticipants(participantDTOs);
|
groupDTO.setParticipants(participantDTOs);
|
||||||
|
groupDTO.setStatus(calculateGroupStatus(participantDTOs));
|
||||||
groupDTOs.add(groupDTO);
|
groupDTOs.add(groupDTO);
|
||||||
displayOrder++;
|
displayOrder++;
|
||||||
}
|
}
|
||||||
@@ -459,6 +461,7 @@ public class MartialScheduleServiceImpl extends ServiceImpl<MartialScheduleMappe
|
|||||||
}
|
}
|
||||||
|
|
||||||
groupDTO.setParticipants(participantDTOs);
|
groupDTO.setParticipants(participantDTOs);
|
||||||
|
groupDTO.setStatus(calculateGroupStatus(participantDTOs));
|
||||||
return groupDTO;
|
return groupDTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -972,4 +975,28 @@ public class MartialScheduleServiceImpl extends ServiceImpl<MartialScheduleMappe
|
|||||||
return result > 0;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user