Skip to content

Commit

Permalink
fix: total count 내역 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
DongGeon0908 committed Aug 19, 2024
1 parent 4ce120b commit 64ffe80
Showing 1 changed file with 71 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,63 +35,104 @@ class HeroStatisticsJob(
) {
suspend fun sendHeroStatistics(title: String, fromDate: LocalDateTime, toDate: LocalDateTime) {
coroutineScope {
val groupCount = async(Dispatchers.IO) {
/** 그룹 */
val groupCountByCreatedAt = async(Dispatchers.IO) {
groupRepository.countByCreatedAtBetween(fromDate, toDate)
}.await()
val groupUserCount = async(Dispatchers.IO) {
}
val groupTotalCount = async(Dispatchers.IO) {
groupRepository.count()
}
val groupUserCountByCreatedAt = async(Dispatchers.IO) {
groupUserRepository.countByCreatedAtBetween(fromDate, toDate)
}.await()
val discussionCount = async(Dispatchers.IO) {
}
val groupUserTotalCount = async(Dispatchers.IO) {
groupUserRepository.count()
}

/** 문의하기 */
val discussionCountByCreatedAt = async(Dispatchers.IO) {
discussionRepository.countByCreatedAtBetween(fromDate, toDate)
}.await()
val syslogCount = async(Dispatchers.IO) {
}
val discussionTotalCount = async(Dispatchers.IO) {
discussionRepository.count()
}

/** syslog */
val syslogCountByCreatedAt = async(Dispatchers.IO) {
systemActionLogRepository.countByCreatedAtBetween(fromDate, toDate)
}.await()
val poseNotificationCount = async(Dispatchers.IO) {
}
val syslogTotalCount = async(Dispatchers.IO) {
systemActionLogRepository.count()
}

/** 포즈 */
val poseNotificationCountByCreatedAt = async(Dispatchers.IO) {
poseNotificationRepository.countByCreatedAtBetween(fromDate, toDate)
}.await()
val poseSnapshotCount = async(Dispatchers.IO) {
}
val poseNotificationTotalCount = async(Dispatchers.IO) {
poseNotificationRepository.count()
}
val poseSnapshotCountByCreatedAt = async(Dispatchers.IO) {
poseSnapshotRepository.countByCreatedAtBetween(fromDate, toDate)
}.await()
val credentialUserInfoCount = async(Dispatchers.IO) {
}
val poseSnapshotTotalCount = async(Dispatchers.IO) {
poseSnapshotRepository.count()
}

/** 회원 */
val credentialUserInfoCountByCreatedAt = async(Dispatchers.IO) {
credentialUserInfoRepository.countByCreatedAtBetween(fromDate, toDate)
}.await()
val oAuthUserInfoCount = async(Dispatchers.IO) {
}
val credentialUserInfoCountTotalCount = async(Dispatchers.IO) {
credentialUserInfoRepository.count()
}
val oAuthUserInfoCountByCreatedAt = async(Dispatchers.IO) {
oAuthUserInfoRepository.countByCreatedAtBetween(fromDate, toDate)
}.await()
val userInfoCount = async(Dispatchers.IO) {
}
val oAuthUserInfoTotalCount = async(Dispatchers.IO) {
oAuthUserInfoRepository.count()
}
val userInfoCountByCreatedAt = async(Dispatchers.IO) {
userInfoRepository.countByCreatedAtBetween(fromDate, toDate)
}.await()
val imageCount = async(Dispatchers.IO) {
}
val userInfoTotalCount = async(Dispatchers.IO) {
userInfoRepository.count()
}

/** 이미지 */
val imageCountByCreatedAt = async(Dispatchers.IO) {
imageRepository.countByCreatedAtBetween(fromDate, toDate)
}.await()
}
val imageTotalCount = async(Dispatchers.IO) {
imageRepository.count()
}

val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")

val message = """
$title [${fromDate.format(formatter)} ~ ${toDate.format(formatter)}]
그룹
- 그룹 생성수 : $groupCount
- 그룹 유저 생성수 : $groupUserCount
- 그룹 생성수 : ${groupCountByCreatedAt.await()}건 [총합: ${groupTotalCount.await()}건]
- 그룹 유저 생성수 : ${groupUserCountByCreatedAt.await()}건 [총합: ${groupUserTotalCount.await()}건]
문의하기
- 문의하기 생성수 : $discussionCount
- 문의하기 생성수 : ${discussionCountByCreatedAt.await()}건 [총합: ${discussionTotalCount.await()}건]
API
- api 호출량 : $syslogCount
- api 호출량 : ${syslogCountByCreatedAt.await()}건 [총합: ${syslogTotalCount.await()}건]
포즈
- 포즈 알림 설정수 : $poseNotificationCount
- 포즈 스냅샷 생성수 : $poseSnapshotCount
- 포즈 알림 설정수 : ${poseNotificationCountByCreatedAt.await()}건 [총합: ${poseNotificationTotalCount.await()}건]
- 포즈 스냅샷 생성수 : ${poseSnapshotCountByCreatedAt.await()}건 [총합: ${poseSnapshotTotalCount.await()}건]
회원
- 일반 회원가입수 : $credentialUserInfoCount
- OAuth 회원가입수 : $oAuthUserInfoCount
- 유저 생성수 : $userInfoCount
- 일반 회원가입수 : ${credentialUserInfoCountByCreatedAt.await()}건 [총합: ${credentialUserInfoCountTotalCount.await()}건]
- OAuth 회원가입수 : ${oAuthUserInfoCountByCreatedAt.await()}건 [총합: ${oAuthUserInfoTotalCount.await()}건]
- 유저 생성수 : ${userInfoCountByCreatedAt.await()}건 [총합: ${userInfoTotalCount.await()}건]
이미지
- 이미지 생성수 : $imageCount
- 이미지 생성수 : ${imageCountByCreatedAt.await()}건 [총합: ${imageTotalCount.await()}건]
""".trimIndent()

discordWebhookService.sendMessage(SendMessageRequest(message))
Expand Down

0 comments on commit 64ffe80

Please sign in to comment.