Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat] 당첨 내역 반환하는 api 구현 #182

Merged
merged 103 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
b91a85f
infra: 빌드 테스트 yml 작성
DrRivaski Aug 4, 2024
ffd6afb
Merge branch 'refs/heads/develop' into feature/33
DrRivaski Aug 5, 2024
4c6ae62
infra: DB 정보 추가
DrRivaski Aug 5, 2024
ad7d92e
infra: ssh-agent 버전 변경
DrRivaski Aug 5, 2024
14d1887
infra: known_hosts 추가
DrRivaski Aug 5, 2024
31f31a8
infra: db port 변경
DrRivaski Aug 5, 2024
da5c7dc
infra: database test 설정 변경
DrRivaski Aug 5, 2024
05054ab
infra: DB 환경변수 설정 및 application.yml 생성
DrRivaski Aug 5, 2024
372f84c
infra: application.yml 동적 생성 스크립트 수정
DrRivaski Aug 5, 2024
57b7bd1
infra: 레디스 설정 추가
DrRivaski Aug 6, 2024
efb92c9
infra: redis test 추가
DrRivaski Aug 6, 2024
babd1a8
infra: redis 버전 변경
DrRivaski Aug 6, 2024
be93408
infra: redis cli 설치
DrRivaski Aug 6, 2024
212a34c
infra: application.yml 위치 및 내용 확인
DrRivaski Aug 6, 2024
db65184
infra: Github Actions 환경변수에 REDIS_HOST, REDIS_PORT 추가
DrRivaski Aug 6, 2024
4658edd
infra: 환경변수 확인 추가
DrRivaski Aug 6, 2024
bcfb880
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 6, 2024
1706d79
feat: draw_rank column 이름 수정
DrRivaski Aug 6, 2024
8d5e4c8
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 6, 2024
55edd9c
infra: pull_request시 Github Actions 동작하도록 수정
DrRivaski Aug 6, 2024
f1ebddf
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 6, 2024
89b5c0f
cicd test (#54)
hyeokson Aug 6, 2024
409fcd1
[Feat] 기대평 기능 구현 (#57)
hyeokson Aug 8, 2024
d42d605
cicd test (#58)
hyeokson Aug 9, 2024
72ee18b
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 9, 2024
3122173
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 9, 2024
0e2f44d
[Feat] 성공, 실패 상태 코드 수정하기 (#65)
hyeokson Aug 10, 2024
d27eb9d
[Feat]Admin Api 구현 (#67)
hyeokson Aug 10, 2024
9faa347
infra: 레디스 설정 추가
DrRivaski Aug 6, 2024
6fbc9c8
[Feat] 기대평 기능 구현 (#57)
hyeokson Aug 8, 2024
a63f49a
[Refactor] 공유 url 조회하는 api 수정 (#70)
DrRivaski Aug 11, 2024
402432f
[Refactor] 공유 url 조회하는 api 수정 (#70)
DrRivaski Aug 11, 2024
a88eed7
[Feature] static text를 관리하는 enum 구현 (#71)
hyeokson Aug 11, 2024
cf8557f
[Refactor] MainPageController 클래스명 변경 (#72)
hyeokson Aug 11, 2024
f26769f
[Feature] 메인 페이지 GET API 구현하기 (#73)
hyeokson Aug 11, 2024
298efef
[Feature] 어드민 회원가입 기능 구현 (#75)
hyeokson Aug 11, 2024
315b0a6
[Feature] 특정 url에 대해 인가 검사 하지 않도록 구현 (#76)
hyeokson Aug 11, 2024
8675b99
[Refactor] 공유 url 조회하는 api 수정 (#70)
DrRivaski Aug 11, 2024
7c2c6e6
[Refactor] 사용자 생성 시 추첨 참여 정보, 공유 링크 정보, 공유 정보 생성 (#78)
DrRivaski Aug 12, 2024
9c59a7d
[Refactor] 공유 url 조회하는 api 수정 (#70)
DrRivaski Aug 11, 2024
193b559
[Refactor] 사용자 생성 시 추첨 참여 정보, 공유 링크 정보, 공유 정보 생성 (#78)
DrRivaski Aug 12, 2024
21e3305
[Refactor] MainPageCarResponseDto 필드 변경 (#79)
hyeokson Aug 12, 2024
d870037
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 12, 2024
d9d5e5e
Merge branch 'develop' of https://github.com/softeerbootcamp4th/Team2…
DrRivaski Aug 12, 2024
f3f7d76
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 12, 2024
77d7037
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 12, 2024
3503af4
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 13, 2024
28b28be
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 13, 2024
1ae74fe
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 14, 2024
8c56c1c
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 14, 2024
291b5ab
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 14, 2024
2730180
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 14, 2024
eb472b7
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 14, 2024
f08f9ec
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 15, 2024
e6165b5
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 15, 2024
2c6712a
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 15, 2024
2c67299
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 15, 2024
542538c
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 15, 2024
4156984
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 16, 2024
289aec4
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 16, 2024
a7dd18a
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 16, 2024
38f0ae2
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 16, 2024
cac2dba
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 17, 2024
5ba2c24
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 17, 2024
bc053aa
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 17, 2024
974e917
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 17, 2024
0aebd5f
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 17, 2024
33ddfaf
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 17, 2024
9e94555
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 17, 2024
82586f1
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 17, 2024
8c5707b
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 17, 2024
89603dc
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 17, 2024
127eddc
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 18, 2024
8d35cbe
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 19, 2024
534f960
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 19, 2024
f814c02
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 19, 2024
d788a1a
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 19, 2024
cfd539f
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 20, 2024
1989b1e
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 20, 2024
6c6bff9
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 20, 2024
ea3f84d
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 20, 2024
6f083c0
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 20, 2024
3d28ac0
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 20, 2024
97e29ba
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 20, 2024
3431a52
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 20, 2024
f4d7e3f
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 21, 2024
ab1b93b
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 21, 2024
310a61f
feat: 당첨 내역 조회하는 메서드 작성
DrRivaski Aug 21, 2024
1ce3a8f
refactor: 패키지 명 변경
DrRivaski Aug 21, 2024
da333fc
refactor: 패키지 명 변경
DrRivaski Aug 21, 2024
8b98537
chore: 주석 수정
DrRivaski Aug 21, 2024
18fa195
feat: 당첨 내역이 있는 사용자의 응답을 리스트로 수정
DrRivaski Aug 21, 2024
e2a671f
feat: ranking에 따라 S3 이미지 url 반환하는 메서드 작성
DrRivaski Aug 21, 2024
5477e4a
feat: 당첨 내역을 리스트로 만드는 로직 추가
DrRivaski Aug 21, 2024
48c1869
feat: 당첨 내역을 dto 생성
DrRivaski Aug 21, 2024
41accad
test: 테스트코드 수정
DrRivaski Aug 21, 2024
e3ff2d6
feat: 당첨내역 리스트를 반환하는 메서드 수정
DrRivaski Aug 21, 2024
796f735
feat: redis 내역이 없는 경우에 대한 분기 추가
DrRivaski Aug 21, 2024
4eee05f
Merge remote-tracking branch 'upstream/develop' into develop
DrRivaski Aug 21, 2024
3c96ef7
Merge branch 'refs/heads/develop' into feature/179
DrRivaski Aug 21, 2024
19c1c6c
chore: import문 추가
DrRivaski Aug 21, 2024
7e70ed6
chore: 사용하지 않는 import문 삭제
DrRivaski Aug 21, 2024
97c84ed
fix: 메인 페이지 추첨 이벤트 상품 정보 반환할 때 1, 2, 3등 이미지 모두 반환하도록 수정
DrRivaski Aug 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.softeer.backend.fo_domain.draw.dto.main.DrawMainResponseDto;
import com.softeer.backend.fo_domain.draw.dto.participate.DrawModalResponseDto;
import com.softeer.backend.fo_domain.draw.dto.result.DrawHistoryResponseDto;
import com.softeer.backend.fo_domain.draw.dto.history.DrawHistoryResponseDto;
import com.softeer.backend.fo_domain.draw.service.DrawService;
import com.softeer.backend.global.annotation.AuthInfo;
import com.softeer.backend.global.common.response.ResponseDto;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.softeer.backend.fo_domain.draw.dto.history;

import lombok.Builder;
import lombok.Data;

import java.time.LocalDate;

@Data
@Builder
public class DrawHistoryDto {
private int drawRank;
private String image;
private LocalDate winningDate;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.softeer.backend.fo_domain.draw.dto.result;
package com.softeer.backend.fo_domain.draw.dto.history;

import lombok.Data;
import lombok.experimental.SuperBuilder;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.softeer.backend.fo_domain.draw.dto.result;
package com.softeer.backend.fo_domain.draw.dto.history;

import lombok.Data;
import lombok.experimental.SuperBuilder;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package com.softeer.backend.fo_domain.draw.dto.result;
package com.softeer.backend.fo_domain.draw.dto.history;

import com.softeer.backend.fo_domain.draw.dto.modal.WinModal;
import lombok.Data;
import lombok.experimental.SuperBuilder;

import java.util.List;

/**
* 추첨 이벤트 당첨 내역이 있는 경우 응답 DTO 클래스
*/
@Data
@SuperBuilder
public class DrawHistoryWinnerResponseDto extends DrawHistoryResponseDto {
private WinModal winModal;
private List<DrawHistoryDto> historyList;
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@
public interface DrawRepository extends JpaRepository<Draw, Integer> {
@Query("SELECT d FROM Draw d JOIN FETCH d.user WHERE d.rank = :rank")
List<Draw> findDrawWithUser(@Param("rank") int rank);

List<Draw> findAllByUserIdOrderByWinningDateAsc(Integer userId);
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package com.softeer.backend.fo_domain.draw.service;

import com.softeer.backend.fo_domain.draw.domain.Draw;
import com.softeer.backend.fo_domain.draw.domain.DrawParticipationInfo;
import com.softeer.backend.fo_domain.draw.dto.history.DrawHistoryDto;
import com.softeer.backend.fo_domain.draw.dto.main.DrawMainResponseDto;
import com.softeer.backend.fo_domain.draw.dto.participate.DrawModalResponseDto;
import com.softeer.backend.fo_domain.draw.dto.result.DrawHistoryResponseDto;
import com.softeer.backend.fo_domain.draw.dto.history.DrawHistoryResponseDto;
import com.softeer.backend.fo_domain.draw.exception.DrawException;
import com.softeer.backend.fo_domain.draw.repository.DrawParticipationInfoRepository;
import com.softeer.backend.fo_domain.draw.repository.DrawRepository;
import com.softeer.backend.fo_domain.draw.util.DrawAttendanceCountUtil;
import com.softeer.backend.fo_domain.draw.util.DrawResponseGenerateUtil;
import com.softeer.backend.fo_domain.draw.util.DrawUtil;
Expand All @@ -17,6 +20,10 @@
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;

/**
* 추첨 참여 로직을 처리하기 위한 클래스
*/
Expand All @@ -30,11 +37,12 @@ public class DrawService {
private final DrawResponseGenerateUtil drawResponseGenerateUtil;
private final DrawAttendanceCountUtil drawAttendanceCountUtil;
private final DrawSettingManager drawSettingManager;
private final DrawRepository drawRepository;

/**
* 1. 연속 참여일수 조회
* 1-1. 만약 7일 연속 참여했다면 상품 정보 응답
* 1-2. 만약 7일 미만 참여라면 일반 정보 응답
* 1-1. 만약 7일 연속 참여했다면 상품 정보 응답
* 1-2. 만약 7일 미만 참여라면 일반 정보 응답
*/
public DrawMainResponseDto getDrawMainPageInfo(Integer userId) {
// 참여 정보 (연속참여일수) 조회
Expand Down Expand Up @@ -135,16 +143,41 @@ public DrawModalResponseDto participateDrawEvent(Integer userId) {

/**
* 당첨 내역 조회하는 메서드
* 1. DB 조회
* 2. redis 조회
* 3. 내역을 리스트로 만들어서 반환
* 3-1. 내역이 없다면 내역이 없다는 응답 반환
*
* 1. 당첨자라면 WinModal과 같은 당첨 내역 응답
* 2. 낙첨자라면 LoseModal과 같은 공유 url 응답
* @param userId 사용자 아이디
* @return 당첨 내역에 따른 응답
*/
public DrawHistoryResponseDto getDrawHistory(Integer userId) {
int ranking = drawRedisUtil.getRankingIfWinner(userId);
List<Draw> drawList = drawRepository.findAllByUserIdOrderByWinningDateAsc(userId);
List<DrawHistoryDto> drawHistoryList = new ArrayList<>();

// DB내역을 리스트로 만들기
for (Draw draw : drawList) {
int drawRank = draw.getRank();
drawHistoryList.add(DrawHistoryDto.builder()
.drawRank(drawRank)
.winningDate(draw.getWinningDate())
.image(drawResponseGenerateUtil.getImageUrl(drawRank))
.build());
}

// redis 내역을 리스트로 만들기
if (ranking != 0) {
drawHistoryList.add(DrawHistoryDto.builder()
.drawRank(ranking)
.winningDate(LocalDate.now())
.image(drawResponseGenerateUtil.getImageUrl(ranking))
.build());
}

if (!drawHistoryList.isEmpty()) {
// 당첨자라면
return drawResponseGenerateUtil.generateDrawHistoryWinnerResponse(ranking);
return drawResponseGenerateUtil.generateDrawHistoryWinnerResponse(drawHistoryList);
}

// 당첨자가 아니라면
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
package com.softeer.backend.fo_domain.draw.util;

import com.softeer.backend.fo_domain.draw.dto.history.DrawHistoryDto;
import com.softeer.backend.fo_domain.draw.dto.main.DrawMainFullAttendResponseDto;
import com.softeer.backend.fo_domain.draw.dto.main.DrawMainResponseDto;
import com.softeer.backend.fo_domain.draw.dto.participate.DrawLoseModalResponseDto;
import com.softeer.backend.fo_domain.draw.dto.participate.DrawWinModalResponseDto;
import com.softeer.backend.fo_domain.draw.dto.result.DrawHistoryLoserResponseDto;
import com.softeer.backend.fo_domain.draw.dto.result.DrawHistoryWinnerResponseDto;
import com.softeer.backend.fo_domain.draw.dto.history.DrawHistoryLoserResponseDto;
import com.softeer.backend.fo_domain.draw.dto.history.DrawHistoryWinnerResponseDto;
import com.softeer.backend.fo_domain.share.exception.ShareUrlInfoException;
import com.softeer.backend.fo_domain.share.repository.ShareUrlInfoRepository;
import com.softeer.backend.global.common.code.status.ErrorStatus;
import com.softeer.backend.global.staticresources.constant.S3FileName;
import com.softeer.backend.global.staticresources.util.StaticResourceUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

import java.util.List;

/**
* 추첨 이벤트 결과 응답을 생성하는 클래스
*/
Expand All @@ -24,13 +29,14 @@ public class DrawResponseGenerateUtil {
private final ShareUrlInfoRepository shareUrlInfoRepository;
private final DrawUtil drawUtil;
private final DrawModalGenerateUtil drawModalGenerateUtil;
private final StaticResourceUtil staticResourceUtil;


/**
* 7일 연속 출석 시 상품 정보 모달 만들어서 반환하는 메서드
*
* @param invitedNum 초대한 사람 수
* @param remainDrawCount 남은 추첨 기회
* @param invitedNum 초대한 사람 수
* @param remainDrawCount 남은 추첨 기회
* @param drawAttendanceCount 연속 출석 일수
* @return 7일 연속 출석 상품 모달
*/
Expand All @@ -46,8 +52,8 @@ public DrawMainFullAttendResponseDto generateMainFullAttendResponse(int invitedN
/**
* 7일 미만 출석 시 모달 만들어서 반환하는 메서드
*
* @param invitedNum 초대한 사람 수
* @param remainDrawCount 남은 추첨 기회
* @param invitedNum 초대한 사람 수
* @param remainDrawCount 남은 추첨 기회
* @param drawAttendanceCount 연속 출석 일수
* @return 7일 미만 출석 상품 모달
*/
Expand Down Expand Up @@ -90,13 +96,13 @@ public DrawWinModalResponseDto generateDrawWinnerResponse(int ranking) {
/**
* 당첨내역이 있는 경우 당첨 내역 응답 만들어서 반환
*
* @param ranking 등수
* @param drawHistoryList 당첨 내역 리스트
* @return 당첨 내역 응답
*/
public DrawHistoryWinnerResponseDto generateDrawHistoryWinnerResponse(int ranking) {
public DrawHistoryWinnerResponseDto generateDrawHistoryWinnerResponse(List<DrawHistoryDto> drawHistoryList) {
return DrawHistoryWinnerResponseDto.builder()
.isDrawWin(true)
.winModal(drawModalGenerateUtil.generateWinModal(ranking))
.historyList(drawHistoryList)
.build();
}

Expand All @@ -123,4 +129,17 @@ private String getShareUrl(Integer userId) {
return BASE_URL + shareUrlInfoRepository.findShareUrlByUserId(userId)
.orElseThrow(() -> new ShareUrlInfoException(ErrorStatus._NOT_FOUND));
}

/**
* ranking에 따른 s3 이미지 url 반환
*/
public String getImageUrl(int ranking) {
if (ranking == 1) {
return staticResourceUtil.getS3ContentMap().get(S3FileName.DRAW_REWARD_IMAGE_1.name());
} else if (ranking == 2) {
return staticResourceUtil.getS3ContentMap().get(S3FileName.DRAW_REWARD_IMAGE_2.name());
} else {
return staticResourceUtil.getS3ContentMap().get(S3FileName.DRAW_REWARD_IMAGE_3.name());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public class MainPageController {
* 메인 페이지에서 정적 정보를 반환하는 메서드
*/
@GetMapping("/event/static")
public ResponseEntity<ResponseDto<MainPageEventStaticResponseDto>> getEventPageStatic(){
MainPageEventStaticResponseDto mainPageEventStaticResponseDto= mainPageService.getEventPageStatic();
public ResponseEntity<ResponseDto<MainPageEventStaticResponseDto>> getEventPageStatic() {
MainPageEventStaticResponseDto mainPageEventStaticResponseDto = mainPageService.getEventPageStatic();

return ResponseEntity.ok()
.cacheControl(CacheControl.maxAge(1, TimeUnit.DAYS).cachePublic()) // 1일 동안 public 캐싱
Expand All @@ -41,7 +41,7 @@ public ResponseEntity<ResponseDto<MainPageEventStaticResponseDto>> getEventPageS
* 메인 페이지에서 이벤트 정보를 반환하는 메서드
*/
@GetMapping("/event/info")
public ResponseDto<MainPageEventInfoResponseDto> getEventPageInfo(){
public ResponseDto<MainPageEventInfoResponseDto> getEventPageInfo() {

MainPageEventInfoResponseDto mainPageEventInfoResponseDto = mainPageService.getEventPageInfo();

Expand All @@ -52,7 +52,7 @@ public ResponseDto<MainPageEventInfoResponseDto> getEventPageInfo(){
* 메인 페이지에서 자동차 설명 정보를 반환하는 메서드
*/
@GetMapping("/car")
public ResponseEntity<ResponseDto<MainPageCarResponseDto>> getCarPage(){
public ResponseEntity<ResponseDto<MainPageCarResponseDto>> getCarPage() {

MainPageCarResponseDto mainPageCarResponseDto = mainPageService.getCarPage();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class MainPageEventStaticResponseDto {
@Getter
@AllArgsConstructor
@Builder
public static class EventInfo{
public static class EventInfo {

private String title;

Expand All @@ -32,6 +32,8 @@ public static class EventInfo{

private String rewardImage2;

private String rewardImage3;

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class MainPageService {
*/
@Transactional(readOnly = true)
@Cacheable(value = "staticResources", key = "'event'")
public MainPageEventStaticResponseDto getEventPageStatic(){
public MainPageEventStaticResponseDto getEventPageStatic() {

Map<String, String> textContentMap = staticResourceUtil.getTextContentMap();
Map<String, String> s3ContentMap = staticResourceUtil.getS3ContentMap();
Expand All @@ -61,13 +61,15 @@ public MainPageEventStaticResponseDto getEventPageStatic(){
.content(textContentMap.get(StaticTextName.FCFS_CONTENT.name()))
.rewardImage1(s3ContentMap.get(S3FileName.FCFS_REWARD_IMAGE_1.name()))
.rewardImage2(s3ContentMap.get(S3FileName.FCFS_REWARD_IMAGE_2.name()))
.rewardImage3(null)
.build();

MainPageEventStaticResponseDto.EventInfo drawInfo = MainPageEventStaticResponseDto.EventInfo.builder()
.title(textContentMap.get(StaticTextName.DRAW_TITLE.name()))
.content(textContentMap.get(StaticTextName.DRAW_CONTENT.name()))
.rewardImage1(s3ContentMap.get(S3FileName.DRAW_REWARD_IMAGE_1.name()))
.rewardImage2(s3ContentMap.get(S3FileName.DRAW_REWARD_IMAGE_2_3.name()))
.rewardImage2(s3ContentMap.get(S3FileName.DRAW_REWARD_IMAGE_2.name()))
.rewardImage3(s3ContentMap.get(S3FileName.DRAW_REWARD_IMAGE_3.name()))
.build();

return MainPageEventStaticResponseDto.builder()
Expand All @@ -82,7 +84,7 @@ public MainPageEventStaticResponseDto getEventPageStatic(){
* 메인 페이지에서 이벤트 정보를 반환하는 메서드
*/
@Transactional(readOnly = true)
public MainPageEventInfoResponseDto getEventPageInfo(){
public MainPageEventInfoResponseDto getEventPageInfo() {

setTotalVisitorsCount();

Expand All @@ -94,7 +96,7 @@ public MainPageEventInfoResponseDto getEventPageInfo(){
int totalDrawWinner = drawSettingManager.getWinnerNum1()
+ drawSettingManager.getWinnerNum2() + drawSettingManager.getWinnerNum3();

int remainDrawCount = totalDrawWinner - (int)drawRepository.count();
int remainDrawCount = totalDrawWinner - (int) drawRepository.count();

return MainPageEventInfoResponseDto.builder()
.startDate(drawSettingManager.getStartDate().format(eventTimeFormatter))
Expand All @@ -114,7 +116,7 @@ public MainPageEventInfoResponseDto getEventPageInfo(){
}

// 이벤트 기간이면 redis에 사이트 방문자 수 +1 하기
public void setTotalVisitorsCount(){
public void setTotalVisitorsCount() {

LocalDate now = LocalDate.now();

Expand Down
Loading
Loading