commit
9103d67cc1
|
@ -11,9 +11,6 @@ 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(
|
||||
|
@ -44,24 +41,6 @@ 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,
|
||||
|
@ -95,7 +74,6 @@ class AudioContentMainTabAsmrService(
|
|||
return GetContentMainTabAsmrResponse(
|
||||
contentBannerList = contentBannerList,
|
||||
newAsmrContentList = newAsmrContentList,
|
||||
rankAsmrContentList = rankAsmrContentList,
|
||||
creatorList = creatorList,
|
||||
salesCountRankContentList = salesCountRankContentList,
|
||||
eventBannerList = eventBannerList,
|
||||
|
|
|
@ -11,7 +11,6 @@ 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,6 +42,17 @@ class AudioContentMainTabContentService(
|
|||
|
||||
// 새로운 단편 테마
|
||||
val themeOfContentList = audioContentThemeRepository.getActiveThemeOfContent(isAdult = isAdult)
|
||||
.filter {
|
||||
it != "오디오북" &&
|
||||
it != "모닝콜" &&
|
||||
it != "알람" &&
|
||||
it != "슬립콜" &&
|
||||
it != "다시듣기" &&
|
||||
it != "ASMR" &&
|
||||
it != "릴레이" &&
|
||||
it != "챌린지" &&
|
||||
it != "자기소개"
|
||||
}
|
||||
|
||||
// 새로운 단편
|
||||
val newContentList = audioContentRepository.findByTheme(
|
||||
|
@ -75,7 +86,7 @@ class AudioContentMainTabContentService(
|
|||
|
||||
val contentRankCreatorList = rankingService.fetchCreatorBySellContentCountRankTop20(
|
||||
memberId = member.id!!,
|
||||
startDate = dailyRankingStartDate.minusDays(1),
|
||||
startDate = dailyRankingStartDate,
|
||||
endDate = dailyRankingEndDate
|
||||
)
|
||||
|
||||
|
@ -130,7 +141,7 @@ class AudioContentMainTabContentService(
|
|||
fun getAudioContentRanking(
|
||||
memberId: Long,
|
||||
isAdult: Boolean,
|
||||
sortType: String = "매출"
|
||||
sortType: String
|
||||
): List<GetAudioContentRankingItem> {
|
||||
val currentDateTime = LocalDateTime.now()
|
||||
val dailyRankingStartDate = currentDateTime
|
||||
|
@ -145,7 +156,8 @@ class AudioContentMainTabContentService(
|
|||
memberId = memberId,
|
||||
isAdult = isAdult,
|
||||
startDate = dailyRankingStartDate,
|
||||
endDate = dailyRankingEndDate
|
||||
endDate = dailyRankingEndDate,
|
||||
sortType = sortType
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -72,11 +72,6 @@ class AudioContentMainTabHomeService(
|
|||
// 이벤트 배너
|
||||
val eventBannerList = eventService.getEventList(isAdult = member.auth != null)
|
||||
|
||||
/* 채널별 인기 콘텐츠
|
||||
* - 콘텐츠를 4개 이상 등록한 채널
|
||||
* - 주간 콘텐츠 판매 개수 Top 20 채널
|
||||
* - 해당 채널의 누적 판매 개수 Top 4
|
||||
*/
|
||||
val contentRankCreatorList = rankingService.fetchCreatorBySellContentCountRankTop20(
|
||||
memberId = member.id!!,
|
||||
startDate = startDate.minusDays(1),
|
||||
|
|
|
@ -11,9 +11,6 @@ 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(
|
||||
|
@ -44,24 +41,6 @@ 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,
|
||||
|
@ -95,7 +74,6 @@ class AudioContentMainTabLiveReplayService(
|
|||
return GetContentMainTabLiveReplayResponse(
|
||||
contentBannerList = contentBannerList,
|
||||
newLiveReplayContentList = newLiveReplayContentList,
|
||||
rankLiveReplayContentList = rankLiveReplayContentList,
|
||||
creatorList = creatorList,
|
||||
salesCountRankContentList = salesCountRankContentList,
|
||||
eventBannerList = eventBannerList,
|
||||
|
|
|
@ -11,7 +11,6 @@ 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,9 +184,7 @@ class AudioContentMainTabSeriesService(
|
|||
|
||||
val totalCount = rankingService.getCompleteSeriesRankingTotalCount(
|
||||
memberId = memberId,
|
||||
isAdult = isAdult,
|
||||
startDate = monthlyRankingStartDate,
|
||||
endDate = monthlyRankingEndDate
|
||||
isAdult = isAdult
|
||||
)
|
||||
|
||||
val items = rankingService.getCompleteSeriesRanking(
|
||||
|
|
|
@ -209,12 +209,7 @@ class RankingRepository(
|
|||
.fetch()
|
||||
}
|
||||
|
||||
fun getCompleteSeriesRankingTotalCount(
|
||||
memberId: Long,
|
||||
isAdult: Boolean,
|
||||
startDate: LocalDateTime,
|
||||
endDate: LocalDateTime
|
||||
): Int {
|
||||
fun getCompleteSeriesRankingTotalCount(memberId: Long, isAdult: Boolean): Int {
|
||||
val blockMemberCondition = blockMember.member.id.eq(member.id)
|
||||
.and(blockMember.isActive.isTrue)
|
||||
.and(blockMember.blockedMember.id.eq(memberId))
|
||||
|
@ -228,9 +223,6 @@ 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)
|
||||
|
@ -242,11 +234,9 @@ 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
|
||||
}
|
||||
|
@ -263,6 +253,11 @@ 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)
|
||||
|
@ -272,9 +267,6 @@ 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)
|
||||
|
@ -286,11 +278,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(order).on(orderCondition)
|
||||
.leftJoin(blockMember).on(blockMemberCondition)
|
||||
.where(where)
|
||||
.groupBy(series.id)
|
||||
.orderBy(order.can.sum().desc())
|
||||
.orderBy(order.id.count().desc(), series.id.desc())
|
||||
.offset(offset)
|
||||
.limit(limit)
|
||||
.fetch()
|
||||
|
@ -348,7 +340,7 @@ class RankingRepository(
|
|||
val ordersCondition = order.audioContent.id.eq(audioContent.id)
|
||||
.and(order.isActive.isTrue)
|
||||
.and(order.createdAt.goe(startDate))
|
||||
.and(order.createdAt.lt(startDate))
|
||||
.and(order.createdAt.lt(endDate))
|
||||
|
||||
val memberCondition = member.isActive.isTrue
|
||||
.and(member.role.eq(MemberRole.CREATOR))
|
||||
|
|
|
@ -84,15 +84,11 @@ class RankingService(
|
|||
|
||||
fun getCompleteSeriesRankingTotalCount(
|
||||
memberId: Long,
|
||||
isAdult: Boolean,
|
||||
startDate: LocalDateTime,
|
||||
endDate: LocalDateTime
|
||||
isAdult: Boolean
|
||||
): Int {
|
||||
return repository.getCompleteSeriesRankingTotalCount(
|
||||
memberId = memberId,
|
||||
isAdult = isAdult,
|
||||
startDate = startDate,
|
||||
endDate = endDate
|
||||
isAdult = isAdult
|
||||
)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue