-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: 이벤트 11시 푸시 알림 * feat: 이벤트 푸시 알림 밤 10시로 변경 * feat: 쿼리 수정 * feat: 알림 제목, 내용 상수화 처리
- Loading branch information
Showing
7 changed files
with
104 additions
and
4 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
src/main/java/com/depromeet/domain/common/constants/PushNotificationConstants.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,12 @@ | ||
package com.depromeet.domain.common.constants; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.NoArgsConstructor; | ||
|
||
@NoArgsConstructor(access = AccessLevel.PRIVATE) | ||
public class PushNotificationConstants { | ||
public static final String PUSH_SERVICE_TITLE = "10MM"; | ||
public static final String PUSH_SERVICE_CONTENT = "%s님이 회원님을 팔로우하기 시작했습니다🥳"; | ||
public static final String PUSH_NON_COMPLETE_MISSION_SERVICE_CONTENT = | ||
"아직 오늘 미션을 완료하지 않았어요! 10분 동안 빠르게 완료해볼까요?"; | ||
} |
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
9 changes: 9 additions & 0 deletions
9
src/main/java/com/depromeet/domain/member/dao/MemberRepositoryCustom.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,9 @@ | ||
package com.depromeet.domain.member.dao; | ||
|
||
import com.depromeet.domain.member.domain.Member; | ||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
|
||
public interface MemberRepositoryCustom { | ||
List<Member> findMissionNonCompletedMembers(LocalDateTime today); | ||
} |
40 changes: 40 additions & 0 deletions
40
src/main/java/com/depromeet/domain/member/dao/MemberRepositoryImpl.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,40 @@ | ||
package com.depromeet.domain.member.dao; | ||
|
||
import static com.depromeet.domain.member.domain.QMember.*; | ||
import static com.depromeet.domain.mission.domain.QMission.*; | ||
import static com.depromeet.domain.missionRecord.domain.QMissionRecord.*; | ||
|
||
import com.depromeet.domain.member.domain.Member; | ||
import com.depromeet.domain.missionRecord.domain.ImageUploadStatus; | ||
import com.querydsl.jpa.impl.JPAQueryFactory; | ||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
@RequiredArgsConstructor | ||
public class MemberRepositoryImpl implements MemberRepositoryCustom { | ||
|
||
private final JPAQueryFactory jpaQueryFactory; | ||
|
||
@Override | ||
public List<Member> findMissionNonCompletedMembers(LocalDateTime today) { | ||
LocalDateTime start = today.toLocalDate().atStartOfDay(); | ||
LocalDateTime end = today.toLocalDate().atTime(23, 59, 59); | ||
return jpaQueryFactory | ||
.selectFrom(member) | ||
.leftJoin(member.missions, mission) | ||
.fetchJoin() | ||
.leftJoin(mission.missionRecords, missionRecord) | ||
.on(missionRecord.createdAt.between(start, end)) | ||
.where( | ||
missionRecord | ||
.isNull() | ||
.or(missionRecord.uploadStatus.ne(ImageUploadStatus.COMPLETE)), | ||
member.fcmInfo.fcmToken.isNotNull(), | ||
mission.startedAt.loe(today), | ||
mission.finishedAt.goe(today)) | ||
.fetch(); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/main/java/com/depromeet/scheduler/member/MemberBatchScheduler.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,20 @@ | ||
package com.depromeet.scheduler.member; | ||
|
||
import com.depromeet.domain.member.application.MemberService; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.scheduling.annotation.Scheduled; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
@Slf4j | ||
public class MemberBatchScheduler { | ||
private final MemberService memberService; | ||
|
||
@Scheduled(cron = "0 0 22 * * *") | ||
public void pushNotificationByMissionRequest() { | ||
log.info("PushNotification MissionRequest execute"); | ||
memberService.pushNotificationMissionRequest(); | ||
} | ||
} |