Compare commits

..

No commits in common. "56eb6b3ce320a20d2b52df2f4bc9a52e1bc95d4a" and "545836d43cd08c577b6fa4c9a68aa56687b5223d" have entirely different histories.

27 changed files with 195 additions and 964 deletions

View File

@ -77,7 +77,6 @@ interface AudioContentQueryRepository {
memberId: Long,
theme: List<String>,
isAdult: Boolean = false,
contentType: ContentType,
offset: Long = 0,
limit: Long = 20
): List<GetAudioContentMainItem>
@ -85,8 +84,7 @@ interface AudioContentQueryRepository {
fun totalAlarmCountByTheme(
memberId: Long,
theme: List<String>,
isAdult: Boolean = false,
contentType: ContentType
isAdult: Boolean = false
): Int
fun totalCountByTheme(
@ -132,7 +130,6 @@ interface AudioContentQueryRepository {
curationId: Long,
memberId: Long,
isAdult: Boolean,
contentType: ContentType,
offset: Long = 0,
limit: Long = 20
): List<GetAudioContentMainItem>
@ -404,15 +401,7 @@ class AudioContentQueryRepositoryImpl(
} else {
if (contentType != ContentType.ALL) {
where = where.and(
audioContent.member.isNull.or(
audioContent.member.auth.gender.eq(
if (contentType == ContentType.MALE) {
0
} else {
1
}
)
)
audioContent.member.auth.gender.eq(if (contentType == ContentType.MALE) 0 else 1)
)
}
}
@ -455,7 +444,6 @@ class AudioContentQueryRepositoryImpl(
memberId: Long,
theme: List<String>,
isAdult: Boolean,
contentType: ContentType,
offset: Long,
limit: Long
): List<GetAudioContentMainItem> {
@ -476,20 +464,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
}
)
)
)
}
}
if (theme.isNotEmpty()) {
@ -520,12 +494,7 @@ class AudioContentQueryRepositoryImpl(
.fetch()
}
override fun totalAlarmCountByTheme(
memberId: Long,
theme: List<String>,
isAdult: Boolean,
contentType: ContentType
): Int {
override fun totalAlarmCountByTheme(memberId: Long, theme: List<String>, isAdult: Boolean): Int {
val blockMemberCondition = blockMember.member.id.eq(member.id)
.and(blockMember.isActive.isTrue)
.and(blockMember.blockedMember.id.eq(memberId))
@ -541,20 +510,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
}
)
)
)
}
}
if (theme.isNotEmpty()) {
@ -591,15 +546,7 @@ class AudioContentQueryRepositoryImpl(
} else {
if (contentType != ContentType.ALL) {
where = where.and(
audioContent.member.isNull.or(
audioContent.member.auth.gender.eq(
if (contentType == ContentType.MALE) {
0
} else {
1
}
)
)
audioContent.member.auth.gender.eq(if (contentType == ContentType.MALE) 0 else 1)
)
}
}
@ -639,15 +586,7 @@ class AudioContentQueryRepositoryImpl(
} else {
if (contentType != ContentType.ALL) {
where = where.and(
audioContent.member.isNull.or(
audioContent.member.auth.gender.eq(
if (contentType == ContentType.MALE) {
0
} else {
1
}
)
)
audioContent.member.auth.gender.eq(if (contentType == ContentType.MALE) 0 else 1)
)
}
}
@ -694,15 +633,7 @@ class AudioContentQueryRepositoryImpl(
} else {
if (contentType != ContentType.ALL) {
where = where.and(
audioContent.member.isNull.or(
audioContent.member.auth.gender.eq(
if (contentType == ContentType.MALE) {
0
} else {
1
}
)
)
audioContent.member.auth.gender.eq(if (contentType == ContentType.MALE) 0 else 1)
)
}
}
@ -820,15 +751,7 @@ class AudioContentQueryRepositoryImpl(
} else {
if (contentType != ContentType.ALL) {
where = where.and(
audioContent.member.isNull.or(
audioContent.member.auth.gender.eq(
if (contentType == ContentType.MALE) {
0
} else {
1
}
)
)
audioContent.member.auth.gender.eq(if (contentType == ContentType.MALE) 0 else 1)
)
}
}
@ -860,7 +783,6 @@ class AudioContentQueryRepositoryImpl(
curationId: Long,
memberId: Long,
isAdult: Boolean,
contentType: ContentType,
offset: Long,
limit: Long
): List<GetAudioContentMainItem> {
@ -879,20 +801,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
}
)
)
)
}
}
return queryFactory

View File

@ -83,18 +83,11 @@ class AudioContentMainController(
@GetMapping("/theme")
fun getThemeList(
@RequestParam("isAdultContentVisible", required = false) isAdultContentVisible: Boolean? = null,
@RequestParam("contentType", required = false) contentType: ContentType? = null,
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
) = run {
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
ApiResponse.ok(
service.getThemeList(
isAdult = member.auth != null && (isAdultContentVisible ?: true),
contentType = contentType ?: ContentType.ALL
)
)
ApiResponse.ok(service.getThemeList(isAdult = member.auth != null))
}
@GetMapping("/new/all")

View File

@ -26,8 +26,8 @@ class AudioContentMainService(
) {
@Transactional(readOnly = true)
@Cacheable(cacheNames = ["default"], key = "'themeList:' + ':' + #isAdult")
fun getThemeList(isAdult: Boolean, contentType: ContentType): List<String> {
return audioContentThemeRepository.getActiveThemeOfContent(isAdult = isAdult, contentType = contentType)
fun getThemeList(isAdult: Boolean): List<String> {
return audioContentThemeRepository.getActiveThemeOfContent(isAdult = isAdult)
.filter {
it != "모닝콜" &&
it != "알람" &&
@ -73,20 +73,17 @@ class AudioContentMainService(
): GetNewContentAllResponse {
val isAdult = member.auth != null && isAdultContentVisible
val themeList = if (theme.isBlank()) {
audioContentThemeRepository.getActiveThemeOfContent(
isAdult = isAdult,
isFree = isFree,
contentType = contentType
).filter {
it != "모닝콜" &&
it != "알람" &&
it != "슬립콜" &&
it != "다시듣기" &&
it != "ASMR" &&
it != "릴레이" &&
it != "챌린지" &&
it != "자기소개"
}
audioContentThemeRepository.getActiveThemeOfContent(isAdult = isAdult, isFree = isFree)
.filter {
it != "모닝콜" &&
it != "알람" &&
it != "슬립콜" &&
it != "다시듣기" &&
it != "ASMR" &&
it != "릴레이" &&
it != "챌린지" &&
it != "자기소개"
}
} else {
listOf(theme)
}

View File

@ -23,15 +23,7 @@ class AudioContentCurationQueryRepository(private val queryFactory: JPAQueryFact
} else {
if (contentType != ContentType.ALL) {
where = where.and(
audioContent.member.isNull.or(
audioContent.member.auth.gender.eq(
if (contentType == ContentType.MALE) {
0
} else {
1
}
)
)
audioContent.member.auth.gender.eq(if (contentType == ContentType.MALE) 0 else 1)
)
}
}
@ -39,7 +31,6 @@ class AudioContentCurationQueryRepository(private val queryFactory: JPAQueryFact
return queryFactory
.select(audioContent.id)
.from(audioContent)
.innerJoin(audioContent.member, member)
.where(where)
.fetch()
.size
@ -71,15 +62,7 @@ class AudioContentCurationQueryRepository(private val queryFactory: JPAQueryFact
} else {
if (contentType != ContentType.ALL) {
where = where.and(
audioContent.member.isNull.or(
audioContent.member.auth.gender.eq(
if (contentType == ContentType.MALE) {
0
} else {
1
}
)
)
audioContent.member.auth.gender.eq(if (contentType == ContentType.MALE) 0 else 1)
)
}
}

View File

@ -2,7 +2,6 @@ package kr.co.vividnext.sodalive.content.main.tab
import com.querydsl.core.types.dsl.Expressions
import com.querydsl.jpa.impl.JPAQueryFactory
import kr.co.vividnext.sodalive.content.ContentType
import kr.co.vividnext.sodalive.content.QAudioContent.audioContent
import kr.co.vividnext.sodalive.content.main.ContentCreatorResponse
import kr.co.vividnext.sodalive.content.main.QContentCreatorResponse
@ -23,15 +22,13 @@ class AudioContentMainTabRepository(
fun findCreatorByThemeContent(
memberId: Long,
theme: String,
minCount: Int,
isAdult: Boolean,
contentType: ContentType
minCount: Int
): List<ContentCreatorResponse> {
val blockMemberCondition = blockMember.member.id.eq(member.id)
.and(blockMember.isActive.isTrue)
.and(blockMember.blockedMember.id.eq(memberId))
var where = member.isActive.isTrue
val where = member.isActive.isTrue
.and(member.role.eq(MemberRole.CREATOR))
.and(audioContent.isActive.isTrue)
.and(audioContent.price.gt(0))
@ -41,24 +38,6 @@ class AudioContentMainTabRepository(
.and(audioContentTheme.theme.eq(theme))
.and(blockMember.id.isNull)
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
}
)
)
)
}
}
return queryFactory
.select(
QContentCreatorResponse(
@ -82,17 +61,12 @@ class AudioContentMainTabRepository(
.fetch()
}
fun findCreatorWithHasFreeContent(
memberId: Long,
minCount: Int,
isAdult: Boolean,
contentType: ContentType
): List<ContentCreatorResponse> {
fun findCreatorWithHasFreeContent(memberId: Long, minCount: Int): List<ContentCreatorResponse> {
val blockMemberCondition = blockMember.member.id.eq(member.id)
.and(blockMember.isActive.isTrue)
.and(blockMember.blockedMember.id.eq(memberId))
var where = member.isActive.isTrue
val where = member.isActive.isTrue
.and(member.role.eq(MemberRole.CREATOR))
.and(audioContent.isActive.isTrue)
.and(audioContent.price.loe(0))
@ -100,24 +74,6 @@ class AudioContentMainTabRepository(
.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.isNull.or(
audioContent.member.auth.gender.eq(
if (contentType == ContentType.MALE) {
0
} else {
1
}
)
)
)
}
}
return queryFactory
.select(
QContentCreatorResponse(

View File

@ -1,7 +1,6 @@
package kr.co.vividnext.sodalive.content.main.tab
import com.querydsl.jpa.impl.JPAQueryFactory
import kr.co.vividnext.sodalive.content.ContentType
import kr.co.vividnext.sodalive.content.main.tab.QRecommendSeries.recommendSeries
import kr.co.vividnext.sodalive.creator.admin.content.series.QSeries.series
import kr.co.vividnext.sodalive.member.QMember.member
@ -15,27 +14,13 @@ class RecommendSeriesRepository(
@Value("\${cloud.aws.cloud-front.host}")
private val imageHost: String
) {
fun getNewSeriesList(isAdult: Boolean, contentType: ContentType): List<GetRecommendSeriesListResponse> {
fun getNewSeriesList(isAdult: Boolean): List<GetRecommendSeriesListResponse> {
var where = recommendSeries.isActive.isTrue
.and(recommendSeries.isFree.isFalse)
.and(series.isActive.isTrue)
if (!isAdult) {
where = where.and(series.isAdult.isFalse)
} else {
if (contentType != ContentType.ALL) {
where = where.and(
series.member.isNull.or(
series.member.auth.gender.eq(
if (contentType == ContentType.MALE) {
0
} else {
1
}
)
)
)
}
}
return queryFactory
@ -57,27 +42,13 @@ class RecommendSeriesRepository(
.fetch()
}
fun getRecommendSeriesList(isAdult: Boolean, contentType: ContentType): List<GetRecommendSeriesListResponse> {
fun getRecommendSeriesList(isAdult: Boolean): List<GetRecommendSeriesListResponse> {
var where = recommendSeries.isActive.isTrue
.and(recommendSeries.isFree.isTrue)
.and(series.isActive.isTrue)
if (!isAdult) {
where = where.and(series.isAdult.isFalse)
} else {
if (contentType != ContentType.ALL) {
where = where.and(
series.member.isNull.or(
series.member.auth.gender.eq(
if (contentType == ContentType.MALE) {
0
} else {
1
}
)
)
)
}
}
return queryFactory

View File

@ -2,7 +2,6 @@ package kr.co.vividnext.sodalive.content.main.tab.alarm
import kr.co.vividnext.sodalive.common.ApiResponse
import kr.co.vividnext.sodalive.common.SodaException
import kr.co.vividnext.sodalive.content.ContentType
import kr.co.vividnext.sodalive.member.Member
import org.springframework.data.domain.Pageable
import org.springframework.security.core.annotation.AuthenticationPrincipal
@ -16,26 +15,16 @@ import org.springframework.web.bind.annotation.RestController
class AudioContentMainTabAlarmController(private val service: AudioContentMainTabAlarmService) {
@GetMapping
fun fetchContentMainTabAlarm(
@RequestParam("isAdultContentVisible", required = false) isAdultContentVisible: Boolean? = null,
@RequestParam("contentType", required = false) contentType: ContentType? = null,
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
) = run {
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
ApiResponse.ok(
service.fetchData(
isAdultContentVisible = isAdultContentVisible ?: true,
contentType = contentType ?: ContentType.ALL,
member
)
)
ApiResponse.ok(service.fetchData(member))
}
@GetMapping("/all")
fun fetchAlarmContentByTheme(
@RequestParam("theme") theme: 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 {
@ -45,8 +34,6 @@ class AudioContentMainTabAlarmController(private val service: AudioContentMainTa
service.fetchAlarmContentByTheme(
theme,
member,
isAdultContentVisible = isAdultContentVisible ?: true,
contentType = contentType ?: ContentType.ALL,
offset = pageable.offset,
limit = pageable.pageSize.toLong()
)

View File

@ -1,7 +1,6 @@
package kr.co.vividnext.sodalive.content.main.tab.alarm
import kr.co.vividnext.sodalive.content.AudioContentRepository
import kr.co.vividnext.sodalive.content.ContentType
import kr.co.vividnext.sodalive.content.main.GetNewContentAllResponse
import kr.co.vividnext.sodalive.content.main.banner.AudioContentBannerService
import kr.co.vividnext.sodalive.content.main.curation.AudioContentCurationQueryRepository
@ -22,12 +21,8 @@ class AudioContentMainTabAlarmService(
private val eventService: EventService,
private val curationRepository: AudioContentCurationQueryRepository
) {
fun fetchData(
isAdultContentVisible: Boolean,
contentType: ContentType,
member: Member
): GetContentMainTabAlarmResponse {
val isAdult = member.auth != null && isAdultContentVisible
fun fetchData(member: Member): GetContentMainTabAlarmResponse {
val isAdult = member.auth != null
val memberId = member.id!!
val contentBannerList = bannerService.getBannerList(
@ -41,7 +36,6 @@ class AudioContentMainTabAlarmService(
memberId = memberId,
theme = alarmThemeList,
isAdult = isAdult,
contentType = contentType,
limit = 10
)
@ -59,7 +53,6 @@ class AudioContentMainTabAlarmService(
val rankAlarmContentList = rankingService.getContentRanking(
memberId = memberId,
isAdult = isAdult,
contentType = contentType,
startDate = startDate,
endDate = endDate,
theme = alarmThemeList[0]
@ -73,12 +66,10 @@ class AudioContentMainTabAlarmService(
items = contentRepository.findAudioContentByCurationIdV2(
curationId = it.id!!,
memberId = memberId,
isAdult = isAdult,
contentType = contentType
isAdult = isAdult
)
)
}
.filter { it.items.isNotEmpty() }
return GetContentMainTabAlarmResponse(
contentBannerList = contentBannerList,
@ -93,8 +84,6 @@ class AudioContentMainTabAlarmService(
fun fetchAlarmContentByTheme(
theme: String,
member: Member,
isAdultContentVisible: Boolean,
contentType: ContentType,
offset: Long,
limit: Long
): GetNewContentAllResponse {
@ -105,20 +94,18 @@ class AudioContentMainTabAlarmService(
}
val memberId = member.id!!
val isAdult = member.auth != null && isAdultContentVisible
val isAdult = member.auth != null
val totalCount = contentRepository.totalAlarmCountByTheme(
memberId = memberId,
theme = alarmThemeList,
isAdult = isAdult,
contentType = contentType
isAdult = isAdult
)
val items = contentRepository.findAlarmContentByTheme(
memberId = memberId,
theme = alarmThemeList,
isAdult = isAdult,
contentType = contentType,
offset = offset,
limit = limit
)

View File

@ -2,7 +2,6 @@ package kr.co.vividnext.sodalive.content.main.tab.asmr
import kr.co.vividnext.sodalive.common.ApiResponse
import kr.co.vividnext.sodalive.common.SodaException
import kr.co.vividnext.sodalive.content.ContentType
import kr.co.vividnext.sodalive.member.Member
import org.springframework.security.core.annotation.AuthenticationPrincipal
import org.springframework.web.bind.annotation.GetMapping
@ -15,26 +14,16 @@ import org.springframework.web.bind.annotation.RestController
class AudioContentMainTabAsmrController(private val service: AudioContentMainTabAsmrService) {
@GetMapping
fun fetchContentMainTabAsmr(
@RequestParam("isAdultContentVisible", required = false) isAdultContentVisible: Boolean? = null,
@RequestParam("contentType", required = false) contentType: ContentType? = null,
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
) = run {
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
ApiResponse.ok(
service.fetchData(
isAdultContentVisible = isAdultContentVisible ?: true,
contentType = contentType ?: ContentType.ALL,
member
)
)
ApiResponse.ok(service.fetchData(member))
}
@GetMapping("/popular-content-by-creator")
fun getPopularContentByCreator(
@RequestParam creatorId: Long,
@RequestParam("isAdultContentVisible", required = false) isAdultContentVisible: Boolean? = null,
@RequestParam("contentType", required = false) contentType: ContentType? = null,
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
) = run {
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
@ -42,8 +31,7 @@ class AudioContentMainTabAsmrController(private val service: AudioContentMainTab
ApiResponse.ok(
service.getPopularContentByCreator(
creatorId = creatorId,
isAdult = member.auth != null && (isAdultContentVisible ?: true),
contentType = contentType ?: ContentType.ALL
isAdult = member.auth != null
)
)
}

View File

@ -21,12 +21,8 @@ class AudioContentMainTabAsmrService(
private val eventService: EventService,
private val curationRepository: AudioContentCurationQueryRepository
) {
fun fetchData(
isAdultContentVisible: Boolean,
contentType: ContentType,
member: Member
): GetContentMainTabAsmrResponse {
val isAdult = member.auth != null && isAdultContentVisible
fun fetchData(member: Member): GetContentMainTabAsmrResponse {
val isAdult = member.auth != null
val memberId = member.id!!
val theme = "ASMR"
val tabId = 5L
@ -41,23 +37,20 @@ class AudioContentMainTabAsmrService(
memberId = memberId,
theme = listOf(theme),
isAdult = isAdult,
contentType = contentType,
contentType = ContentType.ALL,
limit = 10
)
val creatorList = repository.findCreatorByThemeContent(
memberId = memberId,
theme = theme,
minCount = 4,
isAdult = isAdult,
contentType = contentType
minCount = 4
)
val salesCountRankContentList = if (creatorList.isNotEmpty()) {
rankingService.fetchCreatorContentBySalesCountTop4(
creatorId = creatorList[0].creatorId,
isAdult = isAdult,
contentType = contentType,
theme = theme
)
} else {
@ -73,12 +66,10 @@ class AudioContentMainTabAsmrService(
items = contentRepository.findAudioContentByCurationIdV2(
curationId = it.id!!,
memberId = memberId,
isAdult = isAdult,
contentType = contentType
isAdult = isAdult
)
)
}
.filter { it.items.isNotEmpty() }
return GetContentMainTabAsmrResponse(
contentBannerList = contentBannerList,
@ -90,15 +81,10 @@ class AudioContentMainTabAsmrService(
)
}
fun getPopularContentByCreator(
creatorId: Long,
isAdult: Boolean,
contentType: ContentType
): List<GetAudioContentRankingItem> {
fun getPopularContentByCreator(creatorId: Long, isAdult: Boolean): List<GetAudioContentRankingItem> {
return rankingService.fetchCreatorContentBySalesCountTop4(
creatorId = creatorId,
isAdult = isAdult,
contentType = contentType,
theme = "ASMR"
)
}

View File

@ -34,8 +34,6 @@ class AudioContentMainTabContentController(private val service: AudioContentMain
@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 {
@ -44,8 +42,7 @@ class AudioContentMainTabContentController(private val service: AudioContentMain
ApiResponse.ok(
service.getAudioContentRanking(
memberId = member.id!!,
isAdult = member.auth != null && (isAdultContentVisible ?: true),
contentType = contentType ?: ContentType.ALL,
isAdult = member.auth != null,
sortType = sortType ?: "매출"
)
)
@ -74,8 +71,6 @@ class AudioContentMainTabContentController(private val service: AudioContentMain
@GetMapping("/popular-content-by-creator")
fun getPopularContentByCreator(
@RequestParam creatorId: Long,
@RequestParam("isAdultContentVisible", required = false) isAdultContentVisible: Boolean? = null,
@RequestParam("contentType", required = false) contentType: ContentType? = null,
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
) = run {
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
@ -83,8 +78,7 @@ class AudioContentMainTabContentController(private val service: AudioContentMain
ApiResponse.ok(
service.getPopularContentByCreator(
creatorId = creatorId,
isAdult = member.auth != null && (isAdultContentVisible ?: true),
contentType = contentType ?: ContentType.ALL
isAdult = member.auth != null
)
)
}
@ -92,16 +86,11 @@ class AudioContentMainTabContentController(private val service: AudioContentMain
@GetMapping("/recommend-content-by-tag")
fun getRecommendedContentByTag(
@RequestParam tag: String,
@RequestParam("contentType", required = false) contentType: ContentType? = null,
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
) = run {
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
ApiResponse.ok(
service.getRecommendedContentByTag(
memberId = member.id!!,
tag = tag,
contentType = contentType ?: ContentType.ALL
)
service.getRecommendedContentByTag(memberId = member.id!!, tag = tag)
)
}
}

View File

@ -30,7 +30,7 @@ class AudioContentMainTabContentService(
member: Member
): GetContentMainTabContentResponse {
val memberId = member.id!!
val isAdult = member.auth != null && isAdultContentVisible
val isAdult = member.auth != null
val tabId = 3L
// 단편 배너
@ -41,26 +41,24 @@ class AudioContentMainTabContentService(
)
// 새로운 단편 테마
val themeOfContentList = audioContentThemeRepository.getActiveThemeOfContent(
isAdult = isAdult,
contentType = contentType
).filter {
it != "모닝콜" &&
it != "알람" &&
it != "슬립콜" &&
it != "다시듣기" &&
it != "ASMR" &&
it != "릴레이" &&
it != "챌린지" &&
it != "자기소개"
}
val themeOfContentList = audioContentThemeRepository.getActiveThemeOfContent(isAdult = isAdult)
.filter {
it != "모닝콜" &&
it != "알람" &&
it != "슬립콜" &&
it != "다시듣기" &&
it != "ASMR" &&
it != "릴레이" &&
it != "챌린지" &&
it != "자기소개"
}
// 새로운 단편
val newContentList = audioContentRepository.findByTheme(
memberId = member.id!!,
theme = themeOfContentList,
isAdult = isAdult,
contentType = contentType,
isAdult = member.auth != null,
contentType = ContentType.ALL,
offset = 0,
limit = 10
)
@ -78,7 +76,6 @@ class AudioContentMainTabContentService(
val rankContentList = rankingService.getContentRanking(
memberId = memberId,
isAdult = isAdult,
contentType = contentType,
startDate = dailyRankingStartDate,
endDate = dailyRankingEndDate
)
@ -88,7 +85,6 @@ class AudioContentMainTabContentService(
val contentRankCreatorList = rankingService.fetchCreatorBySellContentCountRankTop20(
memberId = member.id!!,
contentType = contentType,
startDate = dailyRankingStartDate,
endDate = dailyRankingEndDate
)
@ -96,25 +92,20 @@ class AudioContentMainTabContentService(
val likeCountRankContentList = if (contentRankCreatorList.isNotEmpty()) {
rankingService.fetchCreatorContentByLikeCountTop4(
creatorId = contentRankCreatorList[0].creatorId,
isAdult = isAdult,
contentType = contentType
isAdult = member.auth != null
)
} else {
emptyList()
}
val tagList = if (isAdult) {
tagCurationService.getTagList(isAdult = isAdult, contentType = contentType)
tagCurationService.getTagList(isAdult = isAdult)
} else {
emptyList()
}
val tagCurationContentList = if (tagList.isNotEmpty()) {
tagCurationService.getTagCurationContentList(
memberId = memberId,
tag = tagList[0],
contentType = contentType
)
tagCurationService.getTagCurationContentList(memberId = memberId, tag = tagList[0])
} else {
emptyList()
}
@ -126,12 +117,10 @@ class AudioContentMainTabContentService(
items = audioContentRepository.findAudioContentByCurationIdV2(
curationId = it.id!!,
memberId = memberId,
isAdult = isAdult,
contentType = contentType
isAdult = isAdult
)
)
}
.filter { it.items.isNotEmpty() }
return GetContentMainTabContentResponse(
bannerList = contentBannerList,
@ -152,7 +141,6 @@ class AudioContentMainTabContentService(
fun getAudioContentRanking(
memberId: Long,
isAdult: Boolean,
contentType: ContentType,
sortType: String
): List<GetAudioContentRankingItem> {
val currentDateTime = LocalDateTime.now()
@ -167,7 +155,6 @@ class AudioContentMainTabContentService(
return rankingService.getContentRanking(
memberId = memberId,
isAdult = isAdult,
contentType = contentType,
startDate = dailyRankingStartDate,
endDate = dailyRankingEndDate,
sortType = sortType
@ -183,7 +170,7 @@ class AudioContentMainTabContentService(
val isAdult = member.auth != null && isAdultContentVisible
val themeList = if (theme.isBlank()) {
audioContentThemeRepository.getActiveThemeOfContent(isAdult = isAdult, contentType = contentType)
audioContentThemeRepository.getActiveThemeOfContent(isAdult = isAdult)
.filter {
it != "모닝콜" &&
it != "알람" &&
@ -208,23 +195,14 @@ class AudioContentMainTabContentService(
)
}
fun getPopularContentByCreator(
creatorId: Long,
isAdult: Boolean,
contentType: ContentType
): List<GetAudioContentRankingItem> {
fun getPopularContentByCreator(creatorId: Long, isAdult: Boolean): List<GetAudioContentRankingItem> {
return rankingService.fetchCreatorContentByLikeCountTop4(
creatorId = creatorId,
isAdult = isAdult,
contentType = contentType
isAdult = isAdult
)
}
fun getRecommendedContentByTag(
memberId: Long,
tag: String,
contentType: ContentType
): List<GetAudioContentMainItem> {
return tagCurationService.getTagCurationContentList(memberId = memberId, tag = tag, contentType = contentType)
fun getRecommendedContentByTag(memberId: Long, tag: String): List<GetAudioContentMainItem> {
return tagCurationService.getTagCurationContentList(memberId = memberId, tag = tag)
}
}

View File

@ -1,7 +1,6 @@
package kr.co.vividnext.sodalive.content.main.tab.content
import com.querydsl.jpa.impl.JPAQueryFactory
import kr.co.vividnext.sodalive.content.ContentType
import kr.co.vividnext.sodalive.content.QAudioContent.audioContent
import kr.co.vividnext.sodalive.content.main.GetAudioContentMainItem
import kr.co.vividnext.sodalive.content.main.QGetAudioContentMainItem
@ -19,7 +18,7 @@ class ContentMainTabTagCurationRepository(
@Value("\${cloud.aws.cloud-front.host}")
private val imageHost: String
) {
fun getTagList(isAdult: Boolean, contentType: ContentType): List<String> {
fun getTagList(isAdult: Boolean): List<String> {
var where = contentHashTagCuration.isActive.isTrue
.and(audioContent.isActive.isTrue)
.and(audioContent.duration.isNotNull)
@ -28,20 +27,6 @@ class ContentMainTabTagCurationRepository(
if (!isAdult) {
where = where.and(contentHashTagCuration.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
}
)
)
)
}
}
return queryFactory
@ -57,36 +42,18 @@ class ContentMainTabTagCurationRepository(
.fetch()
}
fun getTagCurationContentList(
memberId: Long,
tag: String,
contentType: ContentType
): List<GetAudioContentMainItem> {
fun getTagCurationContentList(memberId: Long, tag: String): List<GetAudioContentMainItem> {
val blockMemberCondition = blockMember.member.id.eq(member.id)
.and(blockMember.isActive.isTrue)
.and(blockMember.blockedMember.id.eq(memberId))
var where = audioContent.isActive.isTrue
val where = audioContent.isActive.isTrue
.and(audioContent.duration.isNotNull)
.and(audioContent.limited.isNull)
.and(blockMember.id.isNull)
.and(contentHashTagCurationItem.isActive.isTrue)
.and(contentHashTagCuration.tag.eq(tag))
if (contentType != ContentType.ALL) {
where = where.and(
audioContent.member.isNull.or(
audioContent.member.auth.gender.eq(
if (contentType == ContentType.MALE) {
0
} else {
1
}
)
)
)
}
return queryFactory
.select(
QGetAudioContentMainItem(

View File

@ -1,20 +1,15 @@
package kr.co.vividnext.sodalive.content.main.tab.content
import kr.co.vividnext.sodalive.content.ContentType
import kr.co.vividnext.sodalive.content.main.GetAudioContentMainItem
import org.springframework.stereotype.Service
@Service
class ContentMainTabTagCurationService(private val repository: ContentMainTabTagCurationRepository) {
fun getTagList(isAdult: Boolean, contentType: ContentType): List<String> {
return repository.getTagList(isAdult = isAdult, contentType = contentType)
fun getTagList(isAdult: Boolean): List<String> {
return repository.getTagList(isAdult = isAdult)
}
fun getTagCurationContentList(
memberId: Long,
tag: String,
contentType: ContentType
): List<GetAudioContentMainItem> {
return repository.getTagCurationContentList(memberId = memberId, tag = tag, contentType = contentType)
fun getTagCurationContentList(memberId: Long, tag: String): List<GetAudioContentMainItem> {
return repository.getTagCurationContentList(memberId = memberId, tag = tag)
}
}

View File

@ -16,25 +16,15 @@ import org.springframework.web.bind.annotation.RestController
class AudioContentMainTabFreeController(private val service: AudioContentMainTabFreeService) {
@GetMapping
fun fetchContentMainFree(
@RequestParam("isAdultContentVisible", required = false) isAdultContentVisible: Boolean? = null,
@RequestParam("contentType", required = false) contentType: ContentType? = null,
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
) = run {
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
ApiResponse.ok(
service.fetchData(
isAdultContentVisible = isAdultContentVisible ?: true,
contentType = contentType ?: ContentType.ALL,
member
)
)
ApiResponse.ok(service.fetchData(member))
}
@GetMapping("/introduce-creator")
fun getIntroduceCreator(
@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 {
@ -43,8 +33,6 @@ class AudioContentMainTabFreeController(private val service: AudioContentMainTab
ApiResponse.ok(
service.getIntroduceCreator(
member,
isAdultContentVisible = isAdultContentVisible ?: true,
contentType = contentType ?: ContentType.ALL,
offset = pageable.offset,
limit = pageable.pageSize.toLong()
)
@ -76,8 +64,6 @@ class AudioContentMainTabFreeController(private val service: AudioContentMainTab
@GetMapping("/popular-content-by-creator")
fun getPopularContentByCreator(
@RequestParam creatorId: Long,
@RequestParam("isAdultContentVisible", required = false) isAdultContentVisible: Boolean? = null,
@RequestParam("contentType", required = false) contentType: ContentType? = null,
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
) = run {
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
@ -85,8 +71,7 @@ class AudioContentMainTabFreeController(private val service: AudioContentMainTab
ApiResponse.ok(
service.getPopularContentByCreator(
creatorId = creatorId,
isAdult = member.auth != null && (isAdultContentVisible ?: true),
contentType = contentType ?: ContentType.ALL
isAdult = member.auth != null
)
)
}

View File

@ -25,12 +25,8 @@ class AudioContentMainTabFreeService(
private val audioContentRepository: AudioContentRepository,
private val audioContentThemeRepository: AudioContentThemeQueryRepository
) {
fun fetchData(
isAdultContentVisible: Boolean,
contentType: ContentType,
member: Member
): GetContentMainTabFreeResponse {
val isAdult = member.auth != null && isAdultContentVisible
fun fetchData(member: Member): GetContentMainTabFreeResponse {
val isAdult = member.auth != null
val memberId = member.id!!
val tabId = 7L
@ -44,43 +40,37 @@ class AudioContentMainTabFreeService(
tabId = tabId,
title = "크리에이터 소개",
isAdult = isAdult
).map {
GetContentCurationResponse(
title = it.title,
items = contentRepository.findAudioContentByCurationIdV2(
curationId = it.id!!,
memberId = memberId,
isAdult = isAdult,
contentType = contentType
)
)
}.filter { it.items.isNotEmpty() }
val recommendSeriesList = recommendSeriesRepository.getRecommendSeriesList(
isAdult = isAdult,
contentType = contentType
)
.map {
GetContentCurationResponse(
title = it.title,
items = contentRepository.findAudioContentByCurationIdV2(
curationId = it.id!!,
memberId = memberId,
isAdult = isAdult
)
)
}
val themeList = audioContentThemeRepository.getActiveThemeOfContent(
isAdult = isAdult,
isFree = true,
contentType = contentType
).filter {
it != "모닝콜" &&
it != "알람" &&
it != "슬립콜" &&
it != "다시듣기" &&
it != "ASMR" &&
it != "릴레이" &&
it != "챌린지" &&
it != "자기소개"
}
val recommendSeriesList = recommendSeriesRepository.getRecommendSeriesList(isAdult = isAdult)
val themeList = audioContentThemeRepository.getActiveThemeOfContent(isAdult = isAdult, isFree = true)
.filter {
it != "모닝콜" &&
it != "알람" &&
it != "슬립콜" &&
it != "다시듣기" &&
it != "ASMR" &&
it != "릴레이" &&
it != "챌린지" &&
it != "자기소개"
}
val newFreeContentList = if (themeList.isNotEmpty()) {
audioContentRepository.findByTheme(
memberId = member.id!!,
theme = themeList,
isAdult = isAdult,
contentType = contentType,
isAdult = member.auth != null,
contentType = ContentType.ALL,
offset = 0,
limit = 10,
isFree = true
@ -89,9 +79,9 @@ class AudioContentMainTabFreeService(
emptyList()
}
val creatorList = repository.findCreatorWithHasFreeContent(memberId, 4, isAdult, contentType)
val creatorList = repository.findCreatorWithHasFreeContent(memberId, 4)
val playCountRankContentList = if (creatorList.isNotEmpty()) {
rankingService.fetchFreeContentByCreatorIdTop4(creatorList[0].creatorId, isAdult, contentType)
rankingService.fetchFreeContentByCreatorIdTop4(creatorList[0].creatorId, isAdult)
} else {
emptyList()
}
@ -104,12 +94,10 @@ class AudioContentMainTabFreeService(
items = contentRepository.findAudioContentByCurationIdV2(
curationId = it.id!!,
memberId = memberId,
isAdult = isAdult,
contentType = contentType
isAdult = isAdult
)
)
}
.filter { it.items.isNotEmpty() }
return GetContentMainTabFreeResponse(
contentBannerList = contentBannerList,
@ -127,14 +115,8 @@ class AudioContentMainTabFreeService(
)
}
fun getIntroduceCreator(
member: Member,
isAdultContentVisible: Boolean,
contentType: ContentType,
offset: Long,
limit: Long
): List<GetAudioContentMainItem> {
val isAdult = member.auth != null && isAdultContentVisible
fun getIntroduceCreator(member: Member, offset: Long, limit: Long): List<GetAudioContentMainItem> {
val isAdult = member.auth != null
val memberId = member.id!!
val introduceCreatorCuration = curationRepository.findByContentMainTabIdAndTitle(
@ -148,7 +130,6 @@ class AudioContentMainTabFreeService(
curationId = introduceCreatorCuration[0].id!!,
memberId = memberId,
isAdult = isAdult,
contentType = contentType,
offset = offset,
limit = limit
)
@ -172,18 +153,18 @@ class AudioContentMainTabFreeService(
} else {
audioContentThemeRepository.getActiveThemeOfContent(
isAdult = member.auth != null && isAdultContentVisible,
isFree = true,
contentType = contentType
).filter {
it != "모닝콜" &&
it != "알람" &&
it != "슬립콜" &&
it != "다시듣기" &&
it != "ASMR" &&
it != "릴레이" &&
it != "챌린지" &&
it != "자기소개"
}
isFree = true
)
.filter {
it != "모닝콜" &&
it != "알람" &&
it != "슬립콜" &&
it != "다시듣기" &&
it != "ASMR" &&
it != "릴레이" &&
it != "챌린지" &&
it != "자기소개"
}
},
isAdult = member.auth != null && isAdultContentVisible,
contentType = contentType,
@ -193,11 +174,7 @@ class AudioContentMainTabFreeService(
)
}
fun getPopularContentByCreator(
creatorId: Long,
isAdult: Boolean,
contentType: ContentType
): List<GetAudioContentRankingItem> {
return rankingService.fetchFreeContentByCreatorIdTop4(creatorId, isAdult, contentType)
fun getPopularContentByCreator(creatorId: Long, isAdult: Boolean): List<GetAudioContentRankingItem> {
return rankingService.fetchFreeContentByCreatorIdTop4(creatorId, isAdult)
}
}

View File

@ -2,7 +2,6 @@ package kr.co.vividnext.sodalive.content.main.tab.home
import kr.co.vividnext.sodalive.common.ApiResponse
import kr.co.vividnext.sodalive.common.SodaException
import kr.co.vividnext.sodalive.content.ContentType
import kr.co.vividnext.sodalive.member.Member
import org.springframework.security.core.annotation.AuthenticationPrincipal
import org.springframework.web.bind.annotation.GetMapping
@ -15,26 +14,16 @@ import org.springframework.web.bind.annotation.RestController
class AudioContentMainTabHomeController(private val service: AudioContentMainTabHomeService) {
@GetMapping
fun fetchContentMainHome(
@RequestParam("isAdultContentVisible", required = false) isAdultContentVisible: Boolean? = null,
@RequestParam("contentType", required = false) contentType: ContentType? = null,
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
) = run {
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
ApiResponse.ok(
service.fetchData(
isAdultContentVisible = isAdultContentVisible ?: true,
contentType = contentType ?: ContentType.ALL,
member
)
)
ApiResponse.ok(service.fetchData(member))
}
@GetMapping("/popular-content-by-creator")
fun getPopularContentByCreator(
@RequestParam creatorId: Long,
@RequestParam("isAdultContentVisible", required = false) isAdultContentVisible: Boolean? = null,
@RequestParam("contentType", required = false) contentType: ContentType? = null,
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
) = run {
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
@ -42,8 +31,7 @@ class AudioContentMainTabHomeController(private val service: AudioContentMainTab
ApiResponse.ok(
service.getPopularContentByCreator(
creatorId = creatorId,
isAdult = member.auth != null && (isAdultContentVisible ?: true),
contentType = contentType ?: ContentType.ALL
isAdult = member.auth != null
)
)
}

View File

@ -1,6 +1,5 @@
package kr.co.vividnext.sodalive.content.main.tab.home
import kr.co.vividnext.sodalive.content.ContentType
import kr.co.vividnext.sodalive.content.main.GetAudioContentRankingItem
import kr.co.vividnext.sodalive.content.main.banner.AudioContentBannerService
import kr.co.vividnext.sodalive.event.EventService
@ -20,11 +19,7 @@ class AudioContentMainTabHomeService(
private val rankingService: RankingService,
private val eventService: EventService
) {
fun fetchData(
isAdultContentVisible: Boolean,
contentType: ContentType,
member: Member
): GetContentMainTabHomeResponse {
fun fetchData(member: Member): GetContentMainTabHomeResponse {
// 주간 랭킹 기간
val currentDateTime = LocalDateTime.now()
val startDate = currentDateTime
@ -42,8 +37,6 @@ class AudioContentMainTabHomeService(
val formattedLastMonday = startDate.format(startDateFormatter)
val formattedLastSunday = endDate.format(endDateFormatter)
val isAdult = member.auth != null && isAdultContentVisible
// 최근 공지사항
val latestNotice = noticeService.getLatestNotice()
@ -51,7 +44,7 @@ class AudioContentMainTabHomeService(
val contentBannerList = bannerService.getBannerList(
tabId = 1,
memberId = member.id!!,
isAdult = isAdult
isAdult = member.auth != null
)
// 인기 크리에이터
@ -63,8 +56,7 @@ class AudioContentMainTabHomeService(
// 인기 시리즈
val rankSeriesList = rankingService.getSeriesRanking(
memberId = member.id!!,
isAdult = isAdult,
contentType = contentType,
isAdult = member.auth != null,
startDate = startDate.minusDays(1),
endDate = endDate
)
@ -72,18 +64,16 @@ class AudioContentMainTabHomeService(
// 인기 콘텐츠
val rankContentList = rankingService.getContentRanking(
memberId = member.id!!,
isAdult = isAdult,
contentType = contentType,
isAdult = member.auth != null,
startDate = startDate.minusDays(1),
endDate = endDate
)
// 이벤트 배너
val eventBannerList = eventService.getEventList(isAdult = isAdult)
val eventBannerList = eventService.getEventList(isAdult = member.auth != null)
val contentRankCreatorList = rankingService.fetchCreatorBySellContentCountRankTop20(
memberId = member.id!!,
contentType = contentType,
startDate = startDate.minusDays(1),
endDate = endDate
)
@ -91,8 +81,7 @@ class AudioContentMainTabHomeService(
val salesCountRankContentList = if (contentRankCreatorList.isNotEmpty()) {
rankingService.fetchCreatorContentBySalesCountTop4(
creatorId = contentRankCreatorList[0].creatorId,
isAdult = isAdult,
contentType = contentType
isAdult = member.auth != null
)
} else {
emptyList()
@ -111,15 +100,10 @@ class AudioContentMainTabHomeService(
)
}
fun getPopularContentByCreator(
creatorId: Long,
isAdult: Boolean,
contentType: ContentType
): List<GetAudioContentRankingItem> {
fun getPopularContentByCreator(creatorId: Long, isAdult: Boolean): List<GetAudioContentRankingItem> {
return rankingService.fetchCreatorContentBySalesCountTop4(
creatorId = creatorId,
isAdult = isAdult,
contentType = contentType
isAdult = isAdult
)
}
}

View File

@ -2,7 +2,6 @@ package kr.co.vividnext.sodalive.content.main.tab.replay
import kr.co.vividnext.sodalive.common.ApiResponse
import kr.co.vividnext.sodalive.common.SodaException
import kr.co.vividnext.sodalive.content.ContentType
import kr.co.vividnext.sodalive.member.Member
import org.springframework.security.core.annotation.AuthenticationPrincipal
import org.springframework.web.bind.annotation.GetMapping
@ -15,26 +14,16 @@ import org.springframework.web.bind.annotation.RestController
class AudioContentMainTabLiveReplayController(private val service: AudioContentMainTabLiveReplayService) {
@GetMapping
fun fetchContentMainTabLiveReplay(
@RequestParam("isAdultContentVisible", required = false) isAdultContentVisible: Boolean? = null,
@RequestParam("contentType", required = false) contentType: ContentType? = null,
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
) = run {
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
ApiResponse.ok(
service.fetchData(
isAdultContentVisible = isAdultContentVisible ?: true,
contentType = contentType ?: ContentType.ALL,
member
)
)
ApiResponse.ok(service.fetchData(member))
}
@GetMapping("/popular-content-by-creator")
fun getPopularContentByCreator(
@RequestParam creatorId: Long,
@RequestParam("isAdultContentVisible", required = false) isAdultContentVisible: Boolean? = null,
@RequestParam("contentType", required = false) contentType: ContentType? = null,
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
) = run {
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
@ -42,8 +31,7 @@ class AudioContentMainTabLiveReplayController(private val service: AudioContentM
ApiResponse.ok(
service.getPopularContentByCreator(
creatorId = creatorId,
isAdult = member.auth != null && (isAdultContentVisible ?: true),
contentType = contentType ?: ContentType.ALL
isAdult = member.auth != null
)
)
}

View File

@ -21,12 +21,8 @@ class AudioContentMainTabLiveReplayService(
private val eventService: EventService,
private val curationRepository: AudioContentCurationQueryRepository
) {
fun fetchData(
isAdultContentVisible: Boolean,
contentType: ContentType,
member: Member
): GetContentMainTabLiveReplayResponse {
val isAdult = member.auth != null && isAdultContentVisible
fun fetchData(member: Member): GetContentMainTabLiveReplayResponse {
val isAdult = member.auth != null
val memberId = member.id!!
val theme = "다시듣기"
val tabId = 6L
@ -41,23 +37,20 @@ class AudioContentMainTabLiveReplayService(
memberId = memberId,
theme = listOf(theme),
isAdult = isAdult,
contentType = contentType,
contentType = ContentType.ALL,
limit = 10
)
val creatorList = repository.findCreatorByThemeContent(
memberId = memberId,
theme = theme,
minCount = 4,
isAdult = isAdult,
contentType = contentType
minCount = 4
)
val salesCountRankContentList = if (creatorList.isNotEmpty()) {
rankingService.fetchCreatorContentBySalesCountTop4(
creatorId = creatorList[0].creatorId,
isAdult = isAdult,
contentType = contentType,
theme = theme
)
} else {
@ -73,12 +66,10 @@ class AudioContentMainTabLiveReplayService(
items = contentRepository.findAudioContentByCurationIdV2(
curationId = it.id!!,
memberId = memberId,
isAdult = isAdult,
contentType = contentType
isAdult = isAdult
)
)
}
.filter { it.items.isNotEmpty() }
return GetContentMainTabLiveReplayResponse(
contentBannerList = contentBannerList,
@ -90,15 +81,10 @@ class AudioContentMainTabLiveReplayService(
)
}
fun getPopularContentByCreator(
creatorId: Long,
isAdult: Boolean,
contentType: ContentType
): List<GetAudioContentRankingItem> {
fun getPopularContentByCreator(creatorId: Long, isAdult: Boolean): List<GetAudioContentRankingItem> {
return rankingService.fetchCreatorContentBySalesCountTop4(
creatorId = creatorId,
isAdult = isAdult,
contentType = contentType,
theme = "다시듣기"
)
}

View File

@ -2,7 +2,6 @@ package kr.co.vividnext.sodalive.content.main.tab.series
import kr.co.vividnext.sodalive.common.ApiResponse
import kr.co.vividnext.sodalive.common.SodaException
import kr.co.vividnext.sodalive.content.ContentType
import kr.co.vividnext.sodalive.member.Member
import org.springframework.data.domain.Pageable
import org.springframework.security.core.annotation.AuthenticationPrincipal
@ -16,25 +15,15 @@ import org.springframework.web.bind.annotation.RestController
class AudioContentMainTabSeriesController(private val service: AudioContentMainTabSeriesService) {
@GetMapping
fun fetchContentMainSeries(
@RequestParam("isAdultContentVisible", required = false) isAdultContentVisible: Boolean? = null,
@RequestParam("contentType", required = false) contentType: ContentType? = null,
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
) = run {
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
ApiResponse.ok(
service.fetchData(
isAdultContentVisible = isAdultContentVisible ?: true,
contentType = contentType ?: ContentType.ALL,
member
)
)
ApiResponse.ok(service.fetchData(member))
}
@GetMapping("/original")
fun getOriginalAudioDramaList(
@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 {
@ -43,8 +32,7 @@ class AudioContentMainTabSeriesController(private val service: AudioContentMainT
ApiResponse.ok(
service.getOriginalAudioDramaList(
memberId = member.id!!,
isAdult = member.auth != null && (isAdultContentVisible ?: true),
contentType = contentType ?: ContentType.ALL,
isAdult = member.auth != null,
offset = pageable.offset,
limit = pageable.pageSize.toLong()
)
@ -53,8 +41,6 @@ class AudioContentMainTabSeriesController(private val service: AudioContentMainT
@GetMapping("/completed-rank")
fun getRank10DaysCompletedSeriesList(
@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 {
@ -63,8 +49,7 @@ class AudioContentMainTabSeriesController(private val service: AudioContentMainT
ApiResponse.ok(
service.getRank10DaysCompletedSeriesList(
memberId = member.id!!,
isAdult = member.auth != null && (isAdultContentVisible ?: true),
contentType = contentType ?: ContentType.ALL,
isAdult = member.auth != null,
offset = pageable.offset,
limit = pageable.pageSize.toLong()
)
@ -74,8 +59,6 @@ class AudioContentMainTabSeriesController(private val service: AudioContentMainT
@GetMapping("/recommend-by-genre")
fun getRecommendSeriesListByGenre(
@RequestParam genreId: Long,
@RequestParam("isAdultContentVisible", required = false) isAdultContentVisible: Boolean? = null,
@RequestParam("contentType", required = false) contentType: ContentType? = null,
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
) = run {
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
@ -84,8 +67,7 @@ class AudioContentMainTabSeriesController(private val service: AudioContentMainT
service.getRecommendSeriesListByGenre(
genreId,
memberId = member.id!!,
isAdult = member.auth != null && (isAdultContentVisible ?: true),
contentType = contentType ?: ContentType.ALL
isAdult = member.auth != null
)
)
}
@ -93,8 +75,6 @@ class AudioContentMainTabSeriesController(private val service: AudioContentMainT
@GetMapping("/recommend-series-by-creator")
fun getRecommendSeriesByCreator(
@RequestParam creatorId: Long,
@RequestParam("isAdultContentVisible", required = false) isAdultContentVisible: Boolean? = null,
@RequestParam("contentType", required = false) contentType: ContentType? = null,
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
) = run {
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
@ -102,8 +82,7 @@ class AudioContentMainTabSeriesController(private val service: AudioContentMainT
ApiResponse.ok(
service.getRecommendSeriesByCreator(
creatorId = creatorId,
isAdult = member.auth != null && (isAdultContentVisible ?: true),
contentType = contentType ?: ContentType.ALL
isAdult = member.auth != null
)
)
}

View File

@ -1,6 +1,5 @@
package kr.co.vividnext.sodalive.content.main.tab.series
import kr.co.vividnext.sodalive.content.ContentType
import kr.co.vividnext.sodalive.content.main.banner.AudioContentBannerService
import kr.co.vividnext.sodalive.content.main.curation.AudioContentCurationQueryRepository
import kr.co.vividnext.sodalive.content.main.tab.RecommendSeriesRepository
@ -25,12 +24,8 @@ class AudioContentMainTabSeriesService(
private val eventService: EventService,
private val curationRepository: AudioContentCurationQueryRepository
) {
fun fetchData(
isAdultContentVisible: Boolean,
contentType: ContentType,
member: Member
): GetContentMainTabSeriesResponse {
val isAdult = member.auth != null && isAdultContentVisible
fun fetchData(member: Member): GetContentMainTabSeriesResponse {
val isAdult = member.auth != null
val memberId = member.id!!
// 메인 배너 (시리즈)
@ -43,7 +38,6 @@ class AudioContentMainTabSeriesService(
val originalAudioDrama = seriesService.getOriginalAudioDramaList(
memberId = memberId,
isAdult = isAdult,
contentType = contentType,
offset = 0,
limit = 20
)
@ -61,20 +55,18 @@ class AudioContentMainTabSeriesService(
val rankSeriesList = rankingService.getSeriesRanking(
memberId = memberId,
isAdult = isAdult,
contentType = contentType,
startDate = dailyRankingStartDate,
endDate = dailyRankingEndDate
)
// 시리즈 장르
val genreList = seriesService.getGenreList(memberId = memberId, isAdult = isAdult, contentType = contentType)
val genreList = seriesService.getGenreList(memberId = memberId, isAdult = isAdult)
// 장르별 추천 시리즈
val recommendSeriesList = if (genreList.isNotEmpty()) {
rankingService.getSeriesAllRankingByGenre(
memberId = memberId,
isAdult = isAdult,
contentType = contentType,
genreId = genreList[0].id
)
} else {
@ -82,14 +74,13 @@ class AudioContentMainTabSeriesService(
}
// 새로운 시리즈
val newSeriesList = recommendSeriesRepository.getNewSeriesList(isAdult = isAdult, contentType = contentType)
val newSeriesList = recommendSeriesRepository.getNewSeriesList(isAdult = isAdult)
val (completedRankStartDate, completedRankEndDate) = calculateStartAndEndDate()
val rankCompleteSeriesList = rankingService.getCompleteSeriesRanking(
memberId = memberId,
isAdult = isAdult,
contentType = contentType,
startDate = completedRankStartDate,
endDate = completedRankEndDate
)
@ -105,7 +96,6 @@ class AudioContentMainTabSeriesService(
val seriesRankCreatorList = rankingService.fetchCreatorBySeriesRevenueRankTop20(
memberId = memberId,
contentType = contentType,
startDate = startDate.minusDays(1),
endDate = endDate
)
@ -113,8 +103,7 @@ class AudioContentMainTabSeriesService(
val salesRankContentList = if (seriesRankCreatorList.isNotEmpty()) {
rankingService.fetchCreatorSeriesBySales(
creatorId = seriesRankCreatorList[0].creatorId,
isAdult = isAdult,
contentType = contentType
isAdult = isAdult
)
} else {
emptyList()
@ -131,8 +120,7 @@ class AudioContentMainTabSeriesService(
items = seriesService.fetchSeriesByCurationId(
curationId = it.id!!,
memberId = memberId,
isAdult = isAdult,
contentType = contentType
isAdult = isAdult
)
)
}
@ -160,15 +148,13 @@ class AudioContentMainTabSeriesService(
fun getOriginalAudioDramaList(
memberId: Long,
isAdult: Boolean,
contentType: ContentType,
offset: Long,
limit: Long
): GetSeriesListResponse {
val totalCount = seriesService.getOriginalAudioDramaTotalCount(memberId, isAdult, contentType)
val totalCount = seriesService.getOriginalAudioDramaTotalCount(memberId, isAdult)
val items = seriesService.getOriginalAudioDramaList(
memberId = memberId,
isAdult = isAdult,
contentType = contentType,
offset = offset,
limit = limit
)
@ -179,7 +165,6 @@ class AudioContentMainTabSeriesService(
fun getRank10DaysCompletedSeriesList(
memberId: Long,
isAdult: Boolean,
contentType: ContentType,
offset: Long,
limit: Long
): GetSeriesListResponse {
@ -187,14 +172,12 @@ class AudioContentMainTabSeriesService(
val totalCount = rankingService.getCompleteSeriesRankingTotalCount(
memberId = memberId,
isAdult = isAdult,
contentType = contentType
isAdult = isAdult
)
val items = rankingService.getCompleteSeriesRanking(
memberId = memberId,
isAdult = isAdult,
contentType = contentType,
startDate = startDate,
endDate = endDate,
offset = offset,
@ -207,26 +190,19 @@ class AudioContentMainTabSeriesService(
fun getRecommendSeriesListByGenre(
genreId: Long,
memberId: Long,
isAdult: Boolean,
contentType: ContentType
isAdult: Boolean
): List<GetSeriesListResponse.SeriesListItem> {
return rankingService.getSeriesAllRankingByGenre(
memberId = memberId,
isAdult = isAdult,
contentType = contentType,
genreId = genreId
)
}
fun getRecommendSeriesByCreator(
creatorId: Long,
isAdult: Boolean,
contentType: ContentType
): List<GetSeriesListResponse.SeriesListItem> {
fun getRecommendSeriesByCreator(creatorId: Long, isAdult: Boolean): List<GetSeriesListResponse.SeriesListItem> {
return rankingService.fetchCreatorSeriesBySales(
creatorId = creatorId,
isAdult = isAdult,
contentType = contentType
isAdult = isAdult
)
}

View File

@ -35,17 +35,10 @@ interface ContentSeriesQueryRepository {
fun getKeywordList(seriesId: Long): List<String>
fun getSeriesContentMinMaxPrice(seriesId: Long): GetSeriesContentMinMaxPriceResponse
fun getRecommendSeriesList(isAuth: Boolean, contentType: ContentType, limit: Long): List<Series>
fun getOriginalAudioDramaList(
memberId: Long,
isAdult: Boolean,
contentType: ContentType,
offset: Long = 0,
limit: Long = 20
): List<Series>
fun getOriginalAudioDramaTotalCount(memberId: Long, isAdult: Boolean, contentType: ContentType): Int
fun getGenreList(isAdult: Boolean, memberId: Long, contentType: ContentType): List<GetSeriesGenreListResponse>
fun findByCurationId(curationId: Long, memberId: Long, isAdult: Boolean, contentType: ContentType): List<Series>
fun getOriginalAudioDramaList(memberId: Long, isAdult: Boolean, offset: Long = 0, limit: Long = 20): List<Series>
fun getOriginalAudioDramaTotalCount(memberId: Long, isAdult: Boolean): Int
fun getGenreList(isAdult: Boolean, memberId: Long): List<GetSeriesGenreListResponse>
fun findByCurationId(curationId: Long, memberId: Long, isAdult: Boolean): List<Series>
}
class ContentSeriesQueryRepositoryImpl(
@ -137,15 +130,7 @@ class ContentSeriesQueryRepositoryImpl(
} else {
if (contentType != ContentType.ALL) {
where = where.and(
series.member.isNull.or(
series.member.auth.gender.eq(
if (contentType == ContentType.MALE) {
0
} else {
1
}
)
)
series.member.auth.gender.eq(if (contentType == ContentType.MALE) 0 else 1)
)
}
}
@ -159,13 +144,7 @@ class ContentSeriesQueryRepositoryImpl(
.fetch()
}
override fun getOriginalAudioDramaList(
memberId: Long,
isAdult: Boolean,
contentType: ContentType,
offset: Long,
limit: Long
): List<Series> {
override fun getOriginalAudioDramaList(memberId: Long, isAdult: Boolean, offset: Long, limit: Long): List<Series> {
val blockMemberCondition = blockMember.member.id.eq(member.id)
.and(blockMember.isActive.isTrue)
.and(blockMember.blockedMember.id.eq(memberId))
@ -176,20 +155,6 @@ class ContentSeriesQueryRepositoryImpl(
if (!isAdult) {
where = where.and(series.isAdult.isFalse)
} else {
if (contentType != ContentType.ALL) {
where = where.and(
series.member.isNull.or(
series.member.auth.gender.eq(
if (contentType == ContentType.MALE) {
0
} else {
1
}
)
)
)
}
}
return queryFactory
@ -203,7 +168,7 @@ class ContentSeriesQueryRepositoryImpl(
.fetch()
}
override fun getOriginalAudioDramaTotalCount(memberId: Long, isAdult: Boolean, contentType: ContentType): Int {
override fun getOriginalAudioDramaTotalCount(memberId: Long, isAdult: Boolean): Int {
val blockMemberCondition = blockMember.member.id.eq(member.id)
.and(blockMember.isActive.isTrue)
.and(blockMember.blockedMember.id.eq(memberId))
@ -214,20 +179,6 @@ class ContentSeriesQueryRepositoryImpl(
if (!isAdult) {
where = where.and(series.isAdult.isFalse)
} else {
if (contentType != ContentType.ALL) {
where = where.and(
series.member.isNull.or(
series.member.auth.gender.eq(
if (contentType == ContentType.MALE) {
0
} else {
1
}
)
)
)
}
}
return queryFactory
@ -240,11 +191,7 @@ class ContentSeriesQueryRepositoryImpl(
.size
}
override fun getGenreList(
isAdult: Boolean,
memberId: Long,
contentType: ContentType
): List<GetSeriesGenreListResponse> {
override fun getGenreList(isAdult: Boolean, memberId: Long): List<GetSeriesGenreListResponse> {
val blockMemberCondition = blockMember.member.id.eq(member.id)
.and(blockMember.isActive.isTrue)
.and(blockMember.blockedMember.id.eq(memberId))
@ -262,20 +209,6 @@ class ContentSeriesQueryRepositoryImpl(
if (!isAdult) {
where = where.and(seriesGenre.isAdult.isFalse)
.and(series.isAdult.isFalse)
} else {
if (contentType != ContentType.ALL) {
where = where.and(
series.member.isNull.or(
series.member.auth.gender.eq(
if (contentType == ContentType.MALE) {
0
} else {
1
}
)
)
)
}
}
return queryFactory
@ -292,12 +225,7 @@ class ContentSeriesQueryRepositoryImpl(
.fetch()
}
override fun findByCurationId(
curationId: Long,
memberId: Long,
isAdult: Boolean,
contentType: ContentType
): List<Series> {
override fun findByCurationId(curationId: Long, memberId: Long, isAdult: Boolean): List<Series> {
val blockMemberCondition = blockMember.member.id.eq(member.id)
.and(blockMember.isActive.isTrue)
.and(blockMember.blockedMember.id.eq(memberId))
@ -311,20 +239,6 @@ class ContentSeriesQueryRepositoryImpl(
if (!isAdult) {
where = where.and(series.isAdult.isFalse)
} else {
if (contentType != ContentType.ALL) {
where = where.and(
series.member.isNull.or(
series.member.auth.gender.eq(
if (contentType == ContentType.MALE) {
0
} else {
1
}
)
)
)
}
}
return queryFactory

View File

@ -30,23 +30,22 @@ class ContentSeriesService(
@Value("\${cloud.aws.cloud-front.host}")
private val coverImageHost: String
) {
fun getOriginalAudioDramaTotalCount(memberId: Long, isAdult: Boolean, contentType: ContentType): Int {
return repository.getOriginalAudioDramaTotalCount(memberId, isAdult, contentType)
fun getOriginalAudioDramaTotalCount(memberId: Long, isAdult: Boolean): Int {
return repository.getOriginalAudioDramaTotalCount(memberId, isAdult)
}
fun getOriginalAudioDramaList(
memberId: Long,
isAdult: Boolean,
contentType: ContentType,
offset: Long = 0,
limit: Long = 20
): List<GetSeriesListResponse.SeriesListItem> {
val originalAudioDramaList = repository.getOriginalAudioDramaList(memberId, isAdult, contentType, offset, limit)
val originalAudioDramaList = repository.getOriginalAudioDramaList(memberId, isAdult, offset, limit)
return seriesToSeriesListItem(originalAudioDramaList, isAdult)
}
fun getGenreList(memberId: Long, isAdult: Boolean, contentType: ContentType): List<GetSeriesGenreListResponse> {
return repository.getGenreList(memberId = memberId, isAdult = isAdult, contentType = contentType)
fun getGenreList(memberId: Long, isAdult: Boolean): List<GetSeriesGenreListResponse> {
return repository.getGenreList(memberId = memberId, isAdult = isAdult)
}
fun getSeriesList(
@ -192,15 +191,9 @@ class ContentSeriesService(
fun fetchSeriesByCurationId(
curationId: Long,
memberId: Long,
isAdult: Boolean,
contentType: ContentType
isAdult: Boolean
): List<GetSeriesListResponse.SeriesListItem> {
val seriesList = repository.findByCurationId(
curationId = curationId,
memberId = memberId,
isAdult = isAdult,
contentType = contentType
)
val seriesList = repository.findByCurationId(curationId = curationId, memberId = memberId, isAdult = isAdult)
return seriesToSeriesListItem(seriesList, isAdult)
}

View File

@ -1,10 +1,8 @@
package kr.co.vividnext.sodalive.content.theme
import com.querydsl.jpa.impl.JPAQueryFactory
import kr.co.vividnext.sodalive.content.ContentType
import kr.co.vividnext.sodalive.content.QAudioContent.audioContent
import kr.co.vividnext.sodalive.content.theme.QAudioContentTheme.audioContentTheme
import kr.co.vividnext.sodalive.member.QMember.member
import org.springframework.beans.factory.annotation.Value
import org.springframework.stereotype.Repository
@ -29,30 +27,12 @@ class AudioContentThemeQueryRepository(
.fetch()
}
fun getActiveThemeOfContent(
isAdult: Boolean = false,
isFree: Boolean = false,
contentType: ContentType
): List<String> {
fun getActiveThemeOfContent(isAdult: Boolean = false, isFree: Boolean = false): List<String> {
var where = audioContent.isActive.isTrue
.and(audioContentTheme.isActive.isTrue)
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
}
)
)
)
}
}
where = if (isFree) {
@ -64,7 +44,6 @@ class AudioContentThemeQueryRepository(
return queryFactory
.select(audioContentTheme.theme)
.from(audioContent)
.innerJoin(audioContent.member, member)
.innerJoin(audioContent.theme, audioContentTheme)
.where(where)
.groupBy(audioContentTheme.id)

View File

@ -3,7 +3,6 @@ package kr.co.vividnext.sodalive.rank
import com.querydsl.core.types.dsl.Expressions
import com.querydsl.jpa.impl.JPAQueryFactory
import kr.co.vividnext.sodalive.admin.content.series.genre.QSeriesGenre.seriesGenre
import kr.co.vividnext.sodalive.content.ContentType
import kr.co.vividnext.sodalive.content.QAudioContent.audioContent
import kr.co.vividnext.sodalive.content.comment.QAudioContentComment.audioContentComment
import kr.co.vividnext.sodalive.content.like.QAudioContentLike.audioContentLike
@ -45,7 +44,6 @@ class RankingRepository(
fun getAudioContentRanking(
memberId: Long,
isAdult: Boolean,
contentType: ContentType,
startDate: LocalDateTime,
endDate: LocalDateTime,
offset: Long,
@ -68,20 +66,6 @@ class RankingRepository(
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
}
)
)
)
}
}
if (theme.isNotBlank()) {
@ -183,7 +167,6 @@ class RankingRepository(
fun getSeriesRanking(
memberId: Long,
isAdult: Boolean,
contentType: ContentType,
startDate: LocalDateTime,
endDate: LocalDateTime
): List<Series> {
@ -205,20 +188,6 @@ class RankingRepository(
if (!isAdult) {
where = where.and(series.isAdult.isFalse)
} else {
if (contentType != ContentType.ALL) {
where = where.and(
series.member.isNull.or(
series.member.auth.gender.eq(
if (contentType == ContentType.MALE) {
0
} else {
1
}
)
)
)
}
}
return queryFactory
@ -240,7 +209,7 @@ class RankingRepository(
.fetch()
}
fun getCompleteSeriesRankingTotalCount(memberId: Long, isAdult: Boolean, contentType: ContentType): 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))
@ -257,20 +226,6 @@ class RankingRepository(
if (!isAdult) {
where = where.and(series.isAdult.isFalse)
} else {
if (contentType != ContentType.ALL) {
where = where.and(
series.member.isNull.or(
series.member.auth.gender.eq(
if (contentType == ContentType.MALE) {
0
} else {
1
}
)
)
)
}
}
return queryFactory
@ -289,7 +244,6 @@ class RankingRepository(
fun getCompleteSeriesRanking(
memberId: Long,
isAdult: Boolean,
contentType: ContentType,
startDate: LocalDateTime,
endDate: LocalDateTime,
offset: Long,
@ -316,20 +270,6 @@ class RankingRepository(
if (!isAdult) {
where = where.and(series.isAdult.isFalse)
} else {
if (contentType != ContentType.ALL) {
where = where.and(
series.member.isNull.or(
series.member.auth.gender.eq(
if (contentType == ContentType.MALE) {
0
} else {
1
}
)
)
)
}
}
return queryFactory
@ -348,12 +288,7 @@ class RankingRepository(
.fetch()
}
fun getSeriesAllRankingByGenre(
memberId: Long,
isAdult: Boolean,
contentType: ContentType,
genreId: Long
): List<Series> {
fun getSeriesAllRankingByGenre(memberId: Long, isAdult: Boolean, genreId: Long): List<Series> {
val blockMemberCondition = blockMember.member.id.eq(member.id)
.and(blockMember.isActive.isTrue)
.and(blockMember.blockedMember.id.eq(memberId))
@ -371,20 +306,6 @@ class RankingRepository(
if (!isAdult) {
where = where.and(series.isAdult.isFalse)
} else {
if (contentType != ContentType.ALL) {
where = where.and(
series.member.isNull.or(
series.member.auth.gender.eq(
if (contentType == ContentType.MALE) {
0
} else {
1
}
)
)
)
}
}
return queryFactory
@ -409,7 +330,6 @@ class RankingRepository(
fun fetchCreatorBySellContentCountRankTop20(
memberId: Long,
contentType: ContentType,
startDate: LocalDateTime,
endDate: LocalDateTime
): List<ContentCreatorResponse> {
@ -422,30 +342,16 @@ class RankingRepository(
.and(order.createdAt.goe(startDate))
.and(order.createdAt.lt(endDate))
var memberCondition = member.isActive.isTrue
val memberCondition = member.isActive.isTrue
.and(member.role.eq(MemberRole.CREATOR))
.and(member.id.eq(audioContent.member.id))
var where = audioContent.isActive.isTrue
val where = audioContent.isActive.isTrue
.and(audioContent.price.gt(0))
.and(audioContent.duration.isNotNull)
.and(audioContent.limited.isNull)
.and(blockMember.id.isNull)
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
.select(
QContentCreatorResponse(
@ -470,7 +376,6 @@ class RankingRepository(
fun fetchCreatorContentBySalesCountTop4(
creatorId: Long,
isAdult: Boolean,
contentType: ContentType,
theme: String
): List<GetAudioContentRankingItem> {
var where = member.isActive.isTrue
@ -484,20 +389,6 @@ class RankingRepository(
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
}
)
)
)
}
}
if (theme.isNotBlank()) {
@ -532,7 +423,6 @@ class RankingRepository(
fun fetchCreatorBySeriesRevenueRankTop20(
memberId: Long,
contentType: ContentType,
startDate: LocalDateTime,
endDate: LocalDateTime
): List<ContentCreatorResponse> {
@ -545,7 +435,7 @@ class RankingRepository(
.and(order.createdAt.goe(startDate))
.and(order.createdAt.lt(startDate))
var where = member.isActive.isTrue
val where = member.isActive.isTrue
.and(member.role.eq(MemberRole.CREATOR))
.and(series.isActive.isTrue)
.and(audioContent.isActive.isTrue)
@ -553,20 +443,6 @@ class RankingRepository(
.and(audioContent.limited.isNull)
.and(blockMember.id.isNull)
if (contentType != ContentType.ALL) {
where = where.and(
audioContent.member.isNull.or(
audioContent.member.auth.gender.eq(
if (contentType == ContentType.MALE) {
0
} else {
1
}
)
)
)
}
return queryFactory
.select(
QContentCreatorResponse(
@ -593,7 +469,7 @@ class RankingRepository(
.fetch()
}
fun fetchCreatorSeriesBySales(creatorId: Long, isAdult: Boolean, contentType: ContentType): List<Series> {
fun fetchCreatorSeriesBySales(creatorId: Long, isAdult: Boolean): List<Series> {
var where = member.isActive.isTrue
.and(member.role.eq(MemberRole.CREATOR))
.and(series.isActive.isTrue)
@ -605,20 +481,6 @@ class RankingRepository(
if (!isAdult) {
where = where.and(series.isAdult.isFalse)
} else {
if (contentType != ContentType.ALL) {
where = where.and(
series.member.isNull.or(
series.member.auth.gender.eq(
if (contentType == ContentType.MALE) {
0
} else {
1
}
)
)
)
}
}
return queryFactory
@ -639,11 +501,7 @@ class RankingRepository(
.fetch()
}
fun fetchFreeContentByCreatorIdTop4(
creatorId: Long,
isAdult: Boolean,
contentType: ContentType
): List<GetAudioContentRankingItem> {
fun fetchFreeContentByCreatorIdTop4(creatorId: Long, isAdult: Boolean): List<GetAudioContentRankingItem> {
var where = member.isActive.isTrue
.and(member.id.eq(creatorId))
.and(member.role.eq(MemberRole.CREATOR))
@ -654,20 +512,6 @@ class RankingRepository(
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
}
)
)
)
}
}
return queryFactory
@ -694,11 +538,7 @@ class RankingRepository(
.fetch()
}
fun fetchCreatorContentByLikeCountTop4(
creatorId: Long,
isAdult: Boolean,
contentType: ContentType
): List<GetAudioContentRankingItem> {
fun fetchCreatorContentByLikeCountTop4(creatorId: Long, isAdult: Boolean): List<GetAudioContentRankingItem> {
var where = member.isActive.isTrue
.and(member.id.eq(creatorId))
.and(member.role.eq(MemberRole.CREATOR))
@ -710,20 +550,6 @@ class RankingRepository(
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
}
)
)
)
}
}
return queryFactory

View File

@ -1,6 +1,5 @@
package kr.co.vividnext.sodalive.rank
import kr.co.vividnext.sodalive.content.ContentType
import kr.co.vividnext.sodalive.content.main.ContentCreatorResponse
import kr.co.vividnext.sodalive.content.main.GetAudioContentRankingItem
import kr.co.vividnext.sodalive.content.series.GetSeriesListResponse
@ -41,7 +40,6 @@ class RankingService(
fun getContentRanking(
memberId: Long,
isAdult: Boolean,
contentType: ContentType,
startDate: LocalDateTime,
endDate: LocalDateTime,
offset: Long = 0,
@ -52,7 +50,6 @@ class RankingService(
return repository.getAudioContentRanking(
memberId = memberId,
isAdult = isAdult,
contentType = contentType,
startDate = startDate,
endDate = endDate,
offset = offset,
@ -65,24 +62,21 @@ class RankingService(
fun getSeriesRanking(
memberId: Long,
isAdult: Boolean,
contentType: ContentType,
startDate: LocalDateTime,
endDate: LocalDateTime
): List<GetSeriesListResponse.SeriesListItem> {
val seriesList = repository.getSeriesRanking(memberId, isAdult, contentType, startDate, endDate)
val seriesList = repository.getSeriesRanking(memberId, isAdult, startDate, endDate)
return seriesToSeriesListItem(seriesList = seriesList, isAdult = isAdult)
}
fun getSeriesAllRankingByGenre(
memberId: Long,
isAdult: Boolean,
contentType: ContentType,
genreId: Long
): List<GetSeriesListResponse.SeriesListItem> {
val seriesList = repository.getSeriesAllRankingByGenre(
memberId = memberId,
isAdult = isAdult,
contentType = contentType,
genreId = genreId
)
return seriesToSeriesListItem(seriesList = seriesList, isAdult = isAdult)
@ -90,20 +84,17 @@ class RankingService(
fun getCompleteSeriesRankingTotalCount(
memberId: Long,
isAdult: Boolean,
contentType: ContentType
isAdult: Boolean
): Int {
return repository.getCompleteSeriesRankingTotalCount(
memberId = memberId,
isAdult = isAdult,
contentType = contentType
isAdult = isAdult
)
}
fun getCompleteSeriesRanking(
memberId: Long,
isAdult: Boolean,
contentType: ContentType,
startDate: LocalDateTime,
endDate: LocalDateTime,
offset: Long = 0,
@ -112,7 +103,6 @@ class RankingService(
val seriesList = repository.getCompleteSeriesRanking(
memberId = memberId,
isAdult = isAdult,
contentType = contentType,
startDate = startDate,
endDate = endDate,
offset = offset,
@ -189,57 +179,38 @@ class RankingService(
fun fetchCreatorBySellContentCountRankTop20(
memberId: Long,
contentType: ContentType,
startDate: LocalDateTime,
endDate: LocalDateTime
): List<ContentCreatorResponse> {
return repository.fetchCreatorBySellContentCountRankTop20(memberId, contentType, startDate, endDate)
return repository.fetchCreatorBySellContentCountRankTop20(memberId, startDate, endDate)
}
fun fetchCreatorContentBySalesCountTop4(
creatorId: Long,
isAdult: Boolean,
contentType: ContentType,
theme: String = ""
): List<GetAudioContentRankingItem> {
return repository.fetchCreatorContentBySalesCountTop4(creatorId, isAdult, contentType, theme)
return repository.fetchCreatorContentBySalesCountTop4(creatorId, isAdult, theme)
}
fun fetchCreatorContentByLikeCountTop4(
creatorId: Long,
isAdult: Boolean,
contentType: ContentType
): List<GetAudioContentRankingItem> {
return repository.fetchCreatorContentByLikeCountTop4(creatorId, isAdult, contentType)
fun fetchCreatorContentByLikeCountTop4(creatorId: Long, isAdult: Boolean): List<GetAudioContentRankingItem> {
return repository.fetchCreatorContentByLikeCountTop4(creatorId, isAdult)
}
fun fetchCreatorBySeriesRevenueRankTop20(
memberId: Long,
contentType: ContentType,
startDate: LocalDateTime,
endDate: LocalDateTime
): List<ContentCreatorResponse> {
return repository.fetchCreatorBySeriesRevenueRankTop20(memberId, contentType, startDate, endDate)
return repository.fetchCreatorBySeriesRevenueRankTop20(memberId, startDate, endDate)
}
fun fetchCreatorSeriesBySales(
creatorId: Long,
isAdult: Boolean,
contentType: ContentType
): List<GetSeriesListResponse.SeriesListItem> {
val seriesList = repository.fetchCreatorSeriesBySales(
creatorId = creatorId,
isAdult = isAdult,
contentType = contentType
)
fun fetchCreatorSeriesBySales(creatorId: Long, isAdult: Boolean): List<GetSeriesListResponse.SeriesListItem> {
val seriesList = repository.fetchCreatorSeriesBySales(creatorId = creatorId, isAdult = isAdult)
return seriesToSeriesListItem(seriesList, isAdult)
}
fun fetchFreeContentByCreatorIdTop4(
creatorId: Long,
isAdult: Boolean,
contentType: ContentType
): List<GetAudioContentRankingItem> {
return repository.fetchFreeContentByCreatorIdTop4(creatorId, isAdult, contentType)
fun fetchFreeContentByCreatorIdTop4(creatorId: Long, isAdult: Boolean): List<GetAudioContentRankingItem> {
return repository.fetchFreeContentByCreatorIdTop4(creatorId, isAdult)
}
}