Compare commits

..

No commits in common. "3c616474ff34e7661abca1defbf8d72128ebe0d7" and "56eb6b3ce320a20d2b52df2f4bc9a52e1bc95d4a" have entirely different histories.

7 changed files with 33 additions and 91 deletions

View File

@ -175,8 +175,6 @@ class AudioContentController(private val service: AudioContentService) {
@GetMapping("/ranking")
fun getAudioContentRanking(
@RequestParam("sort-type", required = false) sortType: String? = "매출",
@RequestParam("isAdultContentVisible", required = false) isAdultContentVisible: Boolean? = null,
@RequestParam("contentType", required = false) contentType: ContentType? = null,
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?,
pageable: Pageable
) = run {
@ -194,8 +192,7 @@ class AudioContentController(private val service: AudioContentService) {
ApiResponse.ok(
service.getAudioContentRanking(
isAdult = member.auth != null && (isAdultContentVisible ?: true),
contentType = contentType ?: ContentType.ALL,
isAdult = member.auth != null,
startDate = startDate,
endDate = endDate,
offset = pageable.offset,

View File

@ -140,7 +140,6 @@ interface AudioContentQueryRepository {
fun getAudioContentRanking(
cloudfrontHost: String,
isAdult: Boolean,
contentType: ContentType,
startDate: LocalDateTime,
endDate: LocalDateTime,
offset: Long = 0,
@ -923,7 +922,6 @@ class AudioContentQueryRepositoryImpl(
override fun getAudioContentRanking(
cloudfrontHost: String,
isAdult: Boolean,
contentType: ContentType,
startDate: LocalDateTime,
endDate: LocalDateTime,
offset: Long,
@ -940,20 +938,6 @@ class AudioContentQueryRepositoryImpl(
if (!isAdult) {
where = where.and(audioContent.isAdult.isFalse)
} else {
if (contentType != ContentType.ALL) {
where = where.and(
audioContent.member.isNull.or(
audioContent.member.auth.gender.eq(
if (contentType == ContentType.MALE) {
0
} else {
1
}
)
)
)
}
}
var select = queryFactory

View File

@ -759,7 +759,6 @@ class AudioContentService(
)
fun getAudioContentRanking(
isAdult: Boolean,
contentType: ContentType,
startDate: LocalDateTime,
endDate: LocalDateTime,
offset: Long,
@ -775,7 +774,6 @@ class AudioContentService(
startDate = startDate.minusDays(1),
endDate = endDate.minusDays(1),
isAdult = isAdult,
contentType = contentType,
offset = offset,
limit = limit,
sortType = sortType

View File

@ -88,7 +88,6 @@ class AudioContentMainTabContentService(
val contentRankCreatorList = rankingService.fetchCreatorBySellContentCountRankTop20(
memberId = member.id!!,
isAdult = isAdult,
contentType = contentType,
startDate = dailyRankingStartDate,
endDate = dailyRankingEndDate
@ -165,22 +164,14 @@ class AudioContentMainTabContentService(
val dailyRankingEndDate = dailyRankingStartDate
.plusDays(1)
var loopCount = 0
var contentList: List<GetAudioContentRankingItem>
do {
contentList = rankingService.getContentRanking(
memberId = memberId,
isAdult = isAdult,
contentType = contentType,
startDate = dailyRankingStartDate.minusDays(loopCount * 5L),
endDate = dailyRankingEndDate,
sortType = sortType
)
loopCount++
} while (contentList.size < 5 && loopCount < 5)
return contentList
return rankingService.getContentRanking(
memberId = memberId,
isAdult = isAdult,
contentType = contentType,
startDate = dailyRankingStartDate,
endDate = dailyRankingEndDate,
sortType = sortType
)
}
fun getNewContentByTheme(

View File

@ -83,7 +83,6 @@ class AudioContentMainTabHomeService(
val contentRankCreatorList = rankingService.fetchCreatorBySellContentCountRankTop20(
memberId = member.id!!,
isAdult = isAdult,
contentType = contentType,
startDate = startDate.minusDays(1),
endDate = endDate

View File

@ -409,7 +409,6 @@ class RankingRepository(
fun fetchCreatorBySellContentCountRankTop20(
memberId: Long,
isAdult: Boolean,
contentType: ContentType,
startDate: LocalDateTime,
endDate: LocalDateTime
@ -423,7 +422,7 @@ class RankingRepository(
.and(order.createdAt.goe(startDate))
.and(order.createdAt.lt(endDate))
val memberCondition = member.isActive.isTrue
var memberCondition = member.isActive.isTrue
.and(member.role.eq(MemberRole.CREATOR))
.and(member.id.eq(audioContent.member.id))
@ -433,22 +432,18 @@ class RankingRepository(
.and(audioContent.limited.isNull)
.and(blockMember.id.isNull)
if (!isAdult) {
where = where.and(audioContent.isAdult.isFalse)
} else {
if (contentType != ContentType.ALL) {
where = where.and(
audioContent.member.auth.isNull.or(
audioContent.member.auth.gender.eq(
if (contentType == ContentType.MALE) {
0
} else {
1
}
)
if (contentType != ContentType.ALL) {
where = where.and(
audioContent.member.auth.isNull.or(
audioContent.member.auth.gender.eq(
if (contentType == ContentType.MALE) {
0
} else {
1
}
)
)
}
)
}
return queryFactory

View File

@ -49,25 +49,17 @@ class RankingService(
sortType: String = "매출",
theme: String = ""
): List<GetAudioContentRankingItem> {
var loopCount = 0L
var contentList: List<GetAudioContentRankingItem>
do {
contentList = repository.getAudioContentRanking(
memberId = memberId,
isAdult = isAdult,
contentType = contentType,
startDate = startDate.minusWeeks(loopCount),
endDate = endDate,
offset = offset,
limit = limit,
sortType = sortType,
theme = theme
)
loopCount++
} while (contentList.size < 5 && loopCount < 5)
return contentList
return repository.getAudioContentRanking(
memberId = memberId,
isAdult = isAdult,
contentType = contentType,
startDate = startDate,
endDate = endDate,
offset = offset,
limit = limit,
sortType = sortType,
theme = theme
)
}
fun getSeriesRanking(
@ -77,20 +69,7 @@ class RankingService(
startDate: LocalDateTime,
endDate: LocalDateTime
): List<GetSeriesListResponse.SeriesListItem> {
var loopCount = 0L
var seriesList: List<Series>
do {
seriesList = repository.getSeriesRanking(
memberId = memberId,
isAdult = isAdult,
contentType = contentType,
startDate = startDate.minusWeeks(loopCount),
endDate = endDate
)
loopCount++
} while (seriesList.size < 5 && loopCount < 5)
val seriesList = repository.getSeriesRanking(memberId, isAdult, contentType, startDate, endDate)
return seriesToSeriesListItem(seriesList = seriesList, isAdult = isAdult)
}
@ -210,12 +189,11 @@ class RankingService(
fun fetchCreatorBySellContentCountRankTop20(
memberId: Long,
isAdult: Boolean,
contentType: ContentType,
startDate: LocalDateTime,
endDate: LocalDateTime
): List<ContentCreatorResponse> {
return repository.fetchCreatorBySellContentCountRankTop20(memberId, isAdult, contentType, startDate, endDate)
return repository.fetchCreatorBySellContentCountRankTop20(memberId, contentType, startDate, endDate)
}
fun fetchCreatorContentBySalesCountTop4(