Skip to content

Commit

Permalink
fix: AtomicInteger 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
k000927 committed Aug 12, 2024
1 parent 66469d6 commit 80ecceb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@
import java.time.LocalTime;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;

public record LotteryEventDetailResponseDto(
LocalDate startDate, LocalTime startTime,
LocalDate endDate, LocalTime endTime,
AtomicInteger appliedCount, int winnerCount,
int appliedCount, int winnerCount,
LocalDateTime createdAt, LocalDateTime updatedAt) {

public static ArrayList<LotteryEventDetailResponseDto> of(List<LotteryEvent> lotteryEvent) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import lombok.Getter;

import java.time.LocalDateTime;
import java.util.concurrent.atomic.AtomicInteger;

@Getter
@MappedSuperclass
Expand All @@ -22,25 +21,25 @@ public class BaseEvent extends BaseEntity {
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
protected LocalDateTime endDateTime;
protected int winnerCount;
protected AtomicInteger totalAppliedCount;
protected int totalAppliedCount;

// 기본 생성자에서 디폴트 값 설정
public BaseEvent() {
this.startDateTime = LocalDateTime.now();
this.endDateTime = LocalDateTime.now().plusMinutes(10);
this.winnerCount = 0; // 기본 우승자 수를 0으로 설정
this.totalAppliedCount = new AtomicInteger(0);
this.totalAppliedCount = 0;
}

// 특정 값을 설정할 수 있는 생성자
public BaseEvent(LocalDateTime startDateTime, LocalDateTime endDateTime, int winnerCount) {
this.startDateTime = startDateTime;
this.endDateTime = endDateTime;
this.winnerCount = winnerCount;
this.totalAppliedCount = new AtomicInteger(0);
this.totalAppliedCount = 0;
}

public void addAppliedCount(){
this.totalAppliedCount.addAndGet(1);
public void addAppliedCount() {
this.totalAppliedCount++;
}
}

0 comments on commit 80ecceb

Please sign in to comment.