-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Api-v1.0.2-4
- Loading branch information
Showing
23 changed files
with
248 additions
and
24 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
2 changes: 1 addition & 1 deletion
2
DuDoong-Api/src/main/java/band/gosrock/api/alimTalk/service/SendRegisterAlimTalkService.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
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
86 changes: 86 additions & 0 deletions
86
DuDoong-Batch/src/main/java/band/gosrock/job/EventSettlementAlimTalkToHost.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,86 @@ | ||
package band.gosrock.job; | ||
|
||
|
||
import band.gosrock.domain.common.alarm.SettlementKakaoTalkAlarm; | ||
import band.gosrock.domain.domains.event.adaptor.EventAdaptor; | ||
import band.gosrock.domain.domains.event.domain.Event; | ||
import band.gosrock.domain.domains.host.adaptor.HostAdaptor; | ||
import band.gosrock.domain.domains.host.domain.Host; | ||
import band.gosrock.domain.domains.user.adaptor.UserAdaptor; | ||
import band.gosrock.domain.domains.user.domain.User; | ||
import band.gosrock.infrastructure.config.alilmTalk.NcpHelper; | ||
import band.gosrock.parameter.EventJobParameter; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.batch.core.Job; | ||
import org.springframework.batch.core.Step; | ||
import org.springframework.batch.core.configuration.annotation.JobBuilderFactory; | ||
import org.springframework.batch.core.configuration.annotation.JobScope; | ||
import org.springframework.batch.core.configuration.annotation.StepBuilderFactory; | ||
import org.springframework.batch.repeat.RepeatStatus; | ||
import org.springframework.beans.factory.annotation.Qualifier; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
@Slf4j | ||
@RequiredArgsConstructor | ||
@Configuration | ||
public class EventSettlementAlimTalkToHost { | ||
|
||
private static final String JOB_NAME = "이벤트정산_알림톡발송_호스트"; | ||
private static final String BEAN_PREFIX = JOB_NAME + "_"; | ||
|
||
private final JobBuilderFactory jobBuilderFactory; | ||
private final StepBuilderFactory stepBuilderFactory; | ||
private final EventAdaptor eventAdaptor; | ||
private final HostAdaptor hostAdaptor; | ||
private final UserAdaptor userAdaptor; | ||
private final NcpHelper ncpHelper; | ||
|
||
@Bean(BEAN_PREFIX + "eventJobParameter") | ||
@JobScope | ||
public EventJobParameter eventJobParameter() { | ||
return new EventJobParameter(eventAdaptor); | ||
} | ||
|
||
@Qualifier(BEAN_PREFIX + "eventJobParameter") | ||
private final EventJobParameter eventJobParameter; | ||
|
||
@Bean(JOB_NAME) | ||
public Job slackUserStatisticJob() { | ||
return jobBuilderFactory.get(JOB_NAME).preventRestart().start(eventSettlement()).build(); | ||
} | ||
|
||
@Bean(BEAN_PREFIX + "step") | ||
@JobScope | ||
public Step eventSettlement() { | ||
return stepBuilderFactory | ||
.get(BEAN_PREFIX + "step") | ||
.tasklet( | ||
(contribution, chunkContext) -> { | ||
log.info(">>>>> 정산서 전송 안내 알림톡 스탭"); | ||
Event event = eventJobParameter.getEvent(); | ||
Host host = hostAdaptor.findById(event.getHostId()); | ||
User masterUser = userAdaptor.queryUser(host.getMasterUserId()); | ||
|
||
String to = | ||
masterUser | ||
.getProfile() | ||
.getPhoneNumberVo() | ||
.getNaverSmsToNumber(); | ||
String content = | ||
SettlementKakaoTalkAlarm.creationOf( | ||
masterUser.getProfile().getName()); | ||
|
||
ncpHelper.sendSettlementNcpAlimTalk( | ||
to, | ||
SettlementKakaoTalkAlarm.creationTemplateCode(), | ||
content, | ||
SettlementKakaoTalkAlarm.creationHeaderOf(), | ||
masterUser.getProfile().getEmail(), | ||
event.getEventBasic().getName()); | ||
return RepeatStatus.FINISHED; | ||
}) | ||
.build(); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -7,7 +7,6 @@ spring: | |
- common | ||
batch.job.names: ${job.name:NONE} | ||
|
||
|
||
--- | ||
spring: | ||
config: | ||
|
22 changes: 22 additions & 0 deletions
22
DuDoong-Domain/src/main/java/band/gosrock/domain/common/alarm/SettlementKakaoTalkAlarm.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,22 @@ | ||
package band.gosrock.domain.common.alarm; | ||
|
||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
public class SettlementKakaoTalkAlarm { | ||
|
||
public static String creationOf(String hostName) { | ||
return "안녕하세요 " + hostName + "님!\n" + "이메일로 정산서 발송이 완료되어 안내드립니다."; | ||
} | ||
|
||
public static String creationHeaderOf() { | ||
return "정산서 이메일 발송 안내"; | ||
} | ||
|
||
public static String creationTemplateCode() { | ||
return "settlement"; | ||
} | ||
} |
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
13 changes: 13 additions & 0 deletions
13
.../main/java/band/gosrock/domain/domains/event/exception/EventOpenTimeExpiredException.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 band.gosrock.domain.domains.event.exception; | ||
|
||
|
||
import band.gosrock.common.exception.DuDoongCodeException; | ||
|
||
public class EventOpenTimeExpiredException extends DuDoongCodeException { | ||
|
||
public static final DuDoongCodeException EXCEPTION = new EventOpenTimeExpiredException(); | ||
|
||
private EventOpenTimeExpiredException() { | ||
super(EventErrorCode.OPEN_TIME_EXPIRED); | ||
} | ||
} |
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
Oops, something went wrong.