-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
107 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/main/java/com/nexters/dailyphrase/common/enums/PrizeTicketSource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.nexters.dailyphrase.common.enums; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
public enum PrizeTicketSource { | ||
SIGNUP("회원가입"), | ||
SHARE("공유하기"); | ||
|
||
private final String description; | ||
} |
36 changes: 36 additions & 0 deletions
36
src/main/java/com/nexters/dailyphrase/member/business/MemberLoginActionProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.nexters.dailyphrase.member.business; | ||
|
||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
import org.springframework.stereotype.Component; | ||
import org.springframework.transaction.annotation.Propagation; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
import com.nexters.dailyphrase.common.enums.PrizeTicketSource; | ||
import com.nexters.dailyphrase.prize.business.PrizeEventMapper; | ||
import com.nexters.dailyphrase.prize.implement.PrizeTicketCommandAdapter; | ||
import com.nexters.dailyphrase.prize.implement.PrizeTicketQueryAdapter; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class MemberLoginActionProcessor { | ||
|
||
private final Logger logger = LogManager.getLogger(MemberLoginActionProcessor.class); | ||
private final PrizeTicketQueryAdapter prizeTicketQueryAdapter; | ||
private final PrizeTicketCommandAdapter prizeTicketCommandAdapter; | ||
private final PrizeEventMapper prizeEventMapper; | ||
|
||
@Transactional(propagation = Propagation.REQUIRES_NEW) | ||
public void processLoginAction(final Long memberId) { | ||
try { | ||
if (!prizeTicketQueryAdapter.existsByMemberIdAndSource( | ||
memberId, PrizeTicketSource.SIGNUP)) | ||
prizeTicketCommandAdapter.createMultiple( | ||
prizeEventMapper.toPrizeTicketList(memberId, PrizeTicketSource.SIGNUP)); | ||
} catch (Exception e) { | ||
logger.error("MemberService) 회원가입 응모권 발급 중 에러가 발생했습니다."); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters