From 32bde3ae534ab2d75d8fd24d7e999797c75fbc23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=85=E6=88=BF?= Date: Thu, 15 Jan 2026 19:11:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=B0=83=E5=BA=A6=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E5=88=97=E4=BB=8E=E5=90=8E=E7=AB=AF=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E7=9C=9F=E5=AE=9E=E7=8A=B6=E6=80=81=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在CompetitionGroupDTO中添加status字段(0-未开始,1-进行中,2-已完成) - 在MartialScheduleServiceImpl中添加calculateGroupStatus方法计算分组状态 - 状态根据参赛人员签到情况自动计算 Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> --- .../martial/pojo/dto/CompetitionGroupDTO.java | 39 ++----------------- .../impl/MartialScheduleServiceImpl.java | 27 +++++++++++++ 2 files changed, 30 insertions(+), 36 deletions(-) diff --git a/src/main/java/org/springblade/modules/martial/pojo/dto/CompetitionGroupDTO.java b/src/main/java/org/springblade/modules/martial/pojo/dto/CompetitionGroupDTO.java index a13a01a..260d184 100644 --- a/src/main/java/org/springblade/modules/martial/pojo/dto/CompetitionGroupDTO.java +++ b/src/main/java/org/springblade/modules/martial/pojo/dto/CompetitionGroupDTO.java @@ -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 participants; diff --git a/src/main/java/org/springblade/modules/martial/service/impl/MartialScheduleServiceImpl.java b/src/main/java/org/springblade/modules/martial/service/impl/MartialScheduleServiceImpl.java index 99cd6a9..0451030 100644 --- a/src/main/java/org/springblade/modules/martial/service/impl/MartialScheduleServiceImpl.java +++ b/src/main/java/org/springblade/modules/martial/service/impl/MartialScheduleServiceImpl.java @@ -262,6 +262,7 @@ public class MartialScheduleServiceImpl extends ServiceImpl 0; } + + /** + * Calculate group status based on participants + * @return 0-not started, 1-in progress, 2-completed + */ + private int calculateGroupStatus(List 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; + } + }