Compare commits
No commits in common. "7041aff3504d53b613971e72ffc94a9bdf18b69b" and "44e3eda145e3e55a1f623668400e567b7bb90680" have entirely different histories.
7041aff350
...
44e3eda145
|
@ -11,6 +11,9 @@ import kr.co.vividnext.sodalive.event.EventService
|
|||
import kr.co.vividnext.sodalive.member.Member
|
||||
import kr.co.vividnext.sodalive.rank.RankingService
|
||||
import org.springframework.stereotype.Service
|
||||
import java.time.DayOfWeek
|
||||
import java.time.LocalDateTime
|
||||
import java.time.temporal.TemporalAdjusters
|
||||
|
||||
@Service
|
||||
class AudioContentMainTabAsmrService(
|
||||
|
@ -41,6 +44,24 @@ class AudioContentMainTabAsmrService(
|
|||
limit = 10
|
||||
)
|
||||
|
||||
val currentDateTime = LocalDateTime.now()
|
||||
val startDate = currentDateTime
|
||||
.withHour(15)
|
||||
.withMinute(0)
|
||||
.withSecond(0)
|
||||
.minusWeeks(1)
|
||||
.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY))
|
||||
val endDate = startDate
|
||||
.plusDays(6)
|
||||
|
||||
val rankAsmrContentList = rankingService.getContentRanking(
|
||||
memberId = memberId,
|
||||
isAdult = isAdult,
|
||||
startDate = startDate,
|
||||
endDate = endDate,
|
||||
theme = theme
|
||||
)
|
||||
|
||||
val creatorList = repository.findCreatorByThemeContent(
|
||||
memberId = memberId,
|
||||
theme = theme,
|
||||
|
@ -74,6 +95,7 @@ class AudioContentMainTabAsmrService(
|
|||
return GetContentMainTabAsmrResponse(
|
||||
contentBannerList = contentBannerList,
|
||||
newAsmrContentList = newAsmrContentList,
|
||||
rankAsmrContentList = rankAsmrContentList,
|
||||
creatorList = creatorList,
|
||||
salesCountRankContentList = salesCountRankContentList,
|
||||
eventBannerList = eventBannerList,
|
||||
|
|
|
@ -11,6 +11,7 @@ data class GetContentMainTabAsmrResponse(
|
|||
val tab: Long = 5,
|
||||
val contentBannerList: List<GetAudioContentBannerResponse>,
|
||||
val newAsmrContentList: List<GetAudioContentMainItem>,
|
||||
val rankAsmrContentList: List<GetAudioContentRankingItem>,
|
||||
val creatorList: List<ContentCreatorResponse>,
|
||||
val salesCountRankContentList: List<GetAudioContentRankingItem>,
|
||||
val eventBannerList: GetEventResponse,
|
||||
|
|
|
@ -33,7 +33,7 @@ class AudioContentMainTabContentController(private val service: AudioContentMain
|
|||
|
||||
@GetMapping("/ranking")
|
||||
fun getAudioContentRanking(
|
||||
@RequestParam("sort-type", required = false) sortType: String?,
|
||||
@RequestParam("sort-type", required = false) sortType: String? = "매출",
|
||||
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?,
|
||||
pageable: Pageable
|
||||
) = run {
|
||||
|
|
|
@ -42,17 +42,6 @@ class AudioContentMainTabContentService(
|
|||
|
||||
// 새로운 단편 테마
|
||||
val themeOfContentList = audioContentThemeRepository.getActiveThemeOfContent(isAdult = isAdult)
|
||||
.filter {
|
||||
it != "오디오북" &&
|
||||
it != "모닝콜" &&
|
||||
it != "알람" &&
|
||||
it != "슬립콜" &&
|
||||
it != "다시듣기" &&
|
||||
it != "ASMR" &&
|
||||
it != "릴레이" &&
|
||||
it != "챌린지" &&
|
||||
it != "자기소개"
|
||||
}
|
||||
|
||||
// 새로운 단편
|
||||
val newContentList = audioContentRepository.findByTheme(
|
||||
|
@ -141,7 +130,7 @@ class AudioContentMainTabContentService(
|
|||
fun getAudioContentRanking(
|
||||
memberId: Long,
|
||||
isAdult: Boolean,
|
||||
sortType: String
|
||||
sortType: String = "매출"
|
||||
): List<GetAudioContentRankingItem> {
|
||||
val currentDateTime = LocalDateTime.now()
|
||||
val dailyRankingStartDate = currentDateTime
|
||||
|
@ -156,8 +145,7 @@ class AudioContentMainTabContentService(
|
|||
memberId = memberId,
|
||||
isAdult = isAdult,
|
||||
startDate = dailyRankingStartDate,
|
||||
endDate = dailyRankingEndDate,
|
||||
sortType = sortType
|
||||
endDate = dailyRankingEndDate
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,9 @@ import kr.co.vividnext.sodalive.event.EventService
|
|||
import kr.co.vividnext.sodalive.member.Member
|
||||
import kr.co.vividnext.sodalive.rank.RankingService
|
||||
import org.springframework.stereotype.Service
|
||||
import java.time.DayOfWeek
|
||||
import java.time.LocalDateTime
|
||||
import java.time.temporal.TemporalAdjusters
|
||||
|
||||
@Service
|
||||
class AudioContentMainTabLiveReplayService(
|
||||
|
@ -41,6 +44,24 @@ class AudioContentMainTabLiveReplayService(
|
|||
limit = 10
|
||||
)
|
||||
|
||||
val currentDateTime = LocalDateTime.now()
|
||||
val startDate = currentDateTime
|
||||
.withHour(15)
|
||||
.withMinute(0)
|
||||
.withSecond(0)
|
||||
.minusWeeks(1)
|
||||
.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY))
|
||||
val endDate = startDate
|
||||
.plusDays(6)
|
||||
|
||||
val rankLiveReplayContentList = rankingService.getContentRanking(
|
||||
memberId = memberId,
|
||||
isAdult = isAdult,
|
||||
startDate = startDate,
|
||||
endDate = endDate,
|
||||
theme = theme
|
||||
)
|
||||
|
||||
val creatorList = repository.findCreatorByThemeContent(
|
||||
memberId = memberId,
|
||||
theme = theme,
|
||||
|
@ -74,6 +95,7 @@ class AudioContentMainTabLiveReplayService(
|
|||
return GetContentMainTabLiveReplayResponse(
|
||||
contentBannerList = contentBannerList,
|
||||
newLiveReplayContentList = newLiveReplayContentList,
|
||||
rankLiveReplayContentList = rankLiveReplayContentList,
|
||||
creatorList = creatorList,
|
||||
salesCountRankContentList = salesCountRankContentList,
|
||||
eventBannerList = eventBannerList,
|
||||
|
|
|
@ -11,6 +11,7 @@ data class GetContentMainTabLiveReplayResponse(
|
|||
val tabId: Long = 6,
|
||||
val contentBannerList: List<GetAudioContentBannerResponse>,
|
||||
val newLiveReplayContentList: List<GetAudioContentMainItem>,
|
||||
val rankLiveReplayContentList: List<GetAudioContentRankingItem>,
|
||||
val creatorList: List<ContentCreatorResponse>,
|
||||
val salesCountRankContentList: List<GetAudioContentRankingItem>,
|
||||
val eventBannerList: GetEventResponse,
|
||||
|
|
|
@ -184,7 +184,9 @@ class AudioContentMainTabSeriesService(
|
|||
|
||||
val totalCount = rankingService.getCompleteSeriesRankingTotalCount(
|
||||
memberId = memberId,
|
||||
isAdult = isAdult
|
||||
isAdult = isAdult,
|
||||
startDate = monthlyRankingStartDate,
|
||||
endDate = monthlyRankingEndDate
|
||||
)
|
||||
|
||||
val items = rankingService.getCompleteSeriesRanking(
|
||||
|
|
|
@ -209,7 +209,12 @@ class RankingRepository(
|
|||
.fetch()
|
||||
}
|
||||
|
||||
fun getCompleteSeriesRankingTotalCount(memberId: Long, isAdult: Boolean): Int {
|
||||
fun getCompleteSeriesRankingTotalCount(
|
||||
memberId: Long,
|
||||
isAdult: Boolean,
|
||||
startDate: LocalDateTime,
|
||||
endDate: LocalDateTime
|
||||
): Int {
|
||||
val blockMemberCondition = blockMember.member.id.eq(member.id)
|
||||
.and(blockMember.isActive.isTrue)
|
||||
.and(blockMember.blockedMember.id.eq(memberId))
|
||||
|
@ -223,6 +228,9 @@ class RankingRepository(
|
|||
.and(audioContent.duration.isNotNull)
|
||||
.and(audioContent.limited.isNull)
|
||||
.and(blockMember.id.isNull)
|
||||
.and(order.isActive.isTrue)
|
||||
.and(order.createdAt.goe(startDate))
|
||||
.and(order.createdAt.lt(endDate))
|
||||
|
||||
if (!isAdult) {
|
||||
where = where.and(series.isAdult.isFalse)
|
||||
|
@ -234,9 +242,11 @@ class RankingRepository(
|
|||
.innerJoin(seriesContent.series, series)
|
||||
.innerJoin(seriesContent.content, audioContent)
|
||||
.innerJoin(series.member, member)
|
||||
.leftJoin(order).on(audioContent.id.eq(order.audioContent.id))
|
||||
.leftJoin(blockMember).on(blockMemberCondition)
|
||||
.where(where)
|
||||
.groupBy(series.id)
|
||||
.orderBy(order.can.sum().desc())
|
||||
.fetch()
|
||||
.size
|
||||
}
|
||||
|
@ -253,11 +263,6 @@ class RankingRepository(
|
|||
.and(blockMember.isActive.isTrue)
|
||||
.and(blockMember.blockedMember.id.eq(memberId))
|
||||
|
||||
val orderCondition = order.isActive.isTrue
|
||||
.and(audioContent.id.eq(order.audioContent.id))
|
||||
.and(order.createdAt.goe(startDate))
|
||||
.and(order.createdAt.lt(endDate))
|
||||
|
||||
var where = series.isActive.isTrue
|
||||
.and(series.state.eq(SeriesState.COMPLETE))
|
||||
.and(audioContent.isActive.isTrue)
|
||||
|
@ -267,6 +272,9 @@ class RankingRepository(
|
|||
.and(audioContent.duration.isNotNull)
|
||||
.and(audioContent.limited.isNull)
|
||||
.and(blockMember.id.isNull)
|
||||
.and(order.isActive.isTrue)
|
||||
.and(order.createdAt.goe(startDate))
|
||||
.and(order.createdAt.lt(endDate))
|
||||
|
||||
if (!isAdult) {
|
||||
where = where.and(series.isAdult.isFalse)
|
||||
|
@ -278,11 +286,11 @@ class RankingRepository(
|
|||
.innerJoin(seriesContent.series, series)
|
||||
.innerJoin(seriesContent.content, audioContent)
|
||||
.innerJoin(series.member, member)
|
||||
.leftJoin(order).on(orderCondition)
|
||||
.leftJoin(order).on(audioContent.id.eq(order.audioContent.id))
|
||||
.leftJoin(blockMember).on(blockMemberCondition)
|
||||
.where(where)
|
||||
.groupBy(series.id)
|
||||
.orderBy(order.id.count().desc(), series.id.desc())
|
||||
.orderBy(order.can.sum().desc())
|
||||
.offset(offset)
|
||||
.limit(limit)
|
||||
.fetch()
|
||||
|
|
|
@ -84,11 +84,15 @@ class RankingService(
|
|||
|
||||
fun getCompleteSeriesRankingTotalCount(
|
||||
memberId: Long,
|
||||
isAdult: Boolean
|
||||
isAdult: Boolean,
|
||||
startDate: LocalDateTime,
|
||||
endDate: LocalDateTime
|
||||
): Int {
|
||||
return repository.getCompleteSeriesRankingTotalCount(
|
||||
memberId = memberId,
|
||||
isAdult = isAdult
|
||||
isAdult = isAdult,
|
||||
startDate = startDate,
|
||||
endDate = endDate
|
||||
)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue