package com.rongyichuang.player.dto; import com.rongyichuang.activity.entity.Activity; import java.time.format.DateTimeFormatter; /** * 比赛晋级列表响应类 */ public class PromotionCompetitionResponse { private Long id; private Long competitionId; private String competitionName; private String stageName; private Integer maxParticipants; private Integer currentCount; private Integer status; private String startTime; private String endTime; private Integer sortOrder; private Integer state; private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); public PromotionCompetitionResponse() {} public PromotionCompetitionResponse(Activity competition, Activity stage, Integer currentCount) { this.id = stage.getId(); this.competitionId = competition.getId(); this.competitionName = competition.getName(); this.stageName = stage.getName(); this.maxParticipants = stage.getPlayerMax(); this.currentCount = currentCount != null ? currentCount : 0; this.status = stage.getState(); this.startTime = stage.getMatchTime() != null ? stage.getMatchTime().format(FORMATTER) : null; this.endTime = stage.getSignupDeadline() != null ? stage.getSignupDeadline().format(FORMATTER) : null; this.sortOrder = stage.getSortOrder(); this.state = stage.getState(); } // Getters and Setters public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Long getCompetitionId() { return competitionId; } public void setCompetitionId(Long competitionId) { this.competitionId = competitionId; } public String getCompetitionName() { return competitionName; } public void setCompetitionName(String competitionName) { this.competitionName = competitionName; } public String getStageName() { return stageName; } public void setStageName(String stageName) { this.stageName = stageName; } public Integer getMaxParticipants() { return maxParticipants; } public void setMaxParticipants(Integer maxParticipants) { this.maxParticipants = maxParticipants; } public Integer getCurrentCount() { return currentCount; } public void setCurrentCount(Integer currentCount) { this.currentCount = currentCount; } public Integer getStatus() { return status; } public void setStatus(Integer status) { this.status = status; } public String getStartTime() { return startTime; } public void setStartTime(String startTime) { this.startTime = startTime; } public String getEndTime() { return endTime; } public void setEndTime(String endTime) { this.endTime = endTime; } public Integer getSortOrder() { return sortOrder; } public void setSortOrder(Integer sortOrder) { this.sortOrder = sortOrder; } public Integer getState() { return state; } public void setState(Integer state) { this.state = state; } }