콘텐츠 메인 - 추천시리즈, 새로운 콘텐츠, 큐레이션 #222
| @@ -64,7 +64,7 @@ interface AudioContentQueryRepository { | |||||||
|         theme: String = "", |         theme: String = "", | ||||||
|         sortType: SortType = SortType.NEWEST, |         sortType: SortType = SortType.NEWEST, | ||||||
|         isAdult: Boolean = false, |         isAdult: Boolean = false, | ||||||
|         contentType: ContentType = ContentType.ALL, |         contentType: ContentType, | ||||||
|         offset: Long = 0, |         offset: Long = 0, | ||||||
|         limit: Long = 20 |         limit: Long = 20 | ||||||
|     ): List<GetAudioContentMainItem> |     ): List<GetAudioContentMainItem> | ||||||
| @@ -72,7 +72,8 @@ interface AudioContentQueryRepository { | |||||||
|     fun totalCountByTheme( |     fun totalCountByTheme( | ||||||
|         memberId: Long, |         memberId: Long, | ||||||
|         theme: String = "", |         theme: String = "", | ||||||
|         isAdult: Boolean = false |         isAdult: Boolean = false, | ||||||
|  |         contentType: ContentType | ||||||
|     ): Int |     ): Int | ||||||
|  |  | ||||||
|     fun findByThemeFor2Weeks( |     fun findByThemeFor2Weeks( | ||||||
| @@ -80,7 +81,7 @@ interface AudioContentQueryRepository { | |||||||
|         memberId: Long, |         memberId: Long, | ||||||
|         theme: String = "", |         theme: String = "", | ||||||
|         isAdult: Boolean = false, |         isAdult: Boolean = false, | ||||||
|         contentType: ContentType = ContentType.ALL, |         contentType: ContentType, | ||||||
|         offset: Long = 0, |         offset: Long = 0, | ||||||
|         limit: Long = 20 |         limit: Long = 20 | ||||||
|     ): List<GetAudioContentMainItem> |     ): List<GetAudioContentMainItem> | ||||||
| @@ -89,7 +90,7 @@ interface AudioContentQueryRepository { | |||||||
|         theme: String, |         theme: String, | ||||||
|         memberId: Long, |         memberId: Long, | ||||||
|         isAdult: Boolean, |         isAdult: Boolean, | ||||||
|         contentType: ContentType = ContentType.ALL |         contentType: ContentType | ||||||
|     ): Int |     ): Int | ||||||
|  |  | ||||||
|     fun getNewContentUploadCreatorList( |     fun getNewContentUploadCreatorList( | ||||||
| @@ -103,7 +104,7 @@ interface AudioContentQueryRepository { | |||||||
|         curationId: Long, |         curationId: Long, | ||||||
|         cloudfrontHost: String, |         cloudfrontHost: String, | ||||||
|         isAdult: Boolean, |         isAdult: Boolean, | ||||||
|         contentType: ContentType = ContentType.ALL |         contentType: ContentType | ||||||
|     ): List<GetAudioContentMainItem> |     ): List<GetAudioContentMainItem> | ||||||
|  |  | ||||||
|     fun getAudioContentRanking( |     fun getAudioContentRanking( | ||||||
| @@ -374,7 +375,6 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) | |||||||
|             if (contentType != ContentType.ALL) { |             if (contentType != ContentType.ALL) { | ||||||
|                 where = where.and( |                 where = where.and( | ||||||
|                     audioContent.member.auth.gender.eq(if (contentType == ContentType.MALE) 0 else 1) |                     audioContent.member.auth.gender.eq(if (contentType == ContentType.MALE) 0 else 1) | ||||||
|                         .or(audioContent.isAdult.isFalse) |  | ||||||
|                 ) |                 ) | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
| @@ -406,7 +406,7 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) | |||||||
|             .fetch() |             .fetch() | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     override fun totalCountByTheme(memberId: Long, theme: String, isAdult: Boolean): Int { |     override fun totalCountByTheme(memberId: Long, theme: String, isAdult: Boolean, contentType: ContentType): Int { | ||||||
|         var where = audioContent.isActive.isTrue |         var where = audioContent.isActive.isTrue | ||||||
|             .and(audioContent.duration.isNotNull) |             .and(audioContent.duration.isNotNull) | ||||||
|             .and( |             .and( | ||||||
| @@ -417,6 +417,12 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) | |||||||
|  |  | ||||||
|         if (!isAdult) { |         if (!isAdult) { | ||||||
|             where = where.and(audioContent.isAdult.isFalse) |             where = where.and(audioContent.isAdult.isFalse) | ||||||
|  |         } else { | ||||||
|  |             if (contentType != ContentType.ALL) { | ||||||
|  |                 where = where.and( | ||||||
|  |                     audioContent.member.auth.gender.eq(if (contentType == ContentType.MALE) 0 else 1) | ||||||
|  |                 ) | ||||||
|  |             } | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         if (theme.isNotBlank()) { |         if (theme.isNotBlank()) { | ||||||
| @@ -454,7 +460,6 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) | |||||||
|             if (contentType != ContentType.ALL) { |             if (contentType != ContentType.ALL) { | ||||||
|                 where = where.and( |                 where = where.and( | ||||||
|                     audioContent.member.auth.gender.eq(if (contentType == ContentType.MALE) 0 else 1) |                     audioContent.member.auth.gender.eq(if (contentType == ContentType.MALE) 0 else 1) | ||||||
|                         .or(audioContent.isAdult.isFalse) |  | ||||||
|                 ) |                 ) | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
| @@ -497,7 +502,6 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) | |||||||
|             if (contentType != ContentType.ALL) { |             if (contentType != ContentType.ALL) { | ||||||
|                 where = where.and( |                 where = where.and( | ||||||
|                     audioContent.member.auth.gender.eq(if (contentType == ContentType.MALE) 0 else 1) |                     audioContent.member.auth.gender.eq(if (contentType == ContentType.MALE) 0 else 1) | ||||||
|                         .or(audioContent.isAdult.isFalse) |  | ||||||
|                 ) |                 ) | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
| @@ -611,7 +615,6 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) | |||||||
|             if (contentType != ContentType.ALL) { |             if (contentType != ContentType.ALL) { | ||||||
|                 where = where.and( |                 where = where.and( | ||||||
|                     audioContent.member.auth.gender.eq(if (contentType == ContentType.MALE) 0 else 1) |                     audioContent.member.auth.gender.eq(if (contentType == ContentType.MALE) 0 else 1) | ||||||
|                         .or(audioContent.isAdult.isFalse) |  | ||||||
|                 ) |                 ) | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -143,7 +143,8 @@ class AudioContentMainService( | |||||||
|     @Transactional(readOnly = true) |     @Transactional(readOnly = true) | ||||||
|     @Cacheable( |     @Cacheable( | ||||||
|         cacheNames = ["default"], |         cacheNames = ["default"], | ||||||
|         key = "'getAudioContentCurationListWithPaging:' + #memberId + ':' + #isAdult + ':' + #offset + ':' + #limit" |         key = "'getAudioContentCurationListWithPaging:' + #memberId + ':' + #isAdult + ':' + #contentType" + | ||||||
|  |             "+ ':' + #offset + ':' + #limit" | ||||||
|     ) |     ) | ||||||
|     fun getAudioContentCurationListWithPaging( |     fun getAudioContentCurationListWithPaging( | ||||||
|         memberId: Long, |         memberId: Long, | ||||||
|   | |||||||
| @@ -2,6 +2,7 @@ package kr.co.vividnext.sodalive.content.series | |||||||
|  |  | ||||||
| import kr.co.vividnext.sodalive.common.ApiResponse | import kr.co.vividnext.sodalive.common.ApiResponse | ||||||
| import kr.co.vividnext.sodalive.common.SodaException | import kr.co.vividnext.sodalive.common.SodaException | ||||||
|  | import kr.co.vividnext.sodalive.content.ContentType | ||||||
| import kr.co.vividnext.sodalive.creator.admin.content.series.SeriesSortType | import kr.co.vividnext.sodalive.creator.admin.content.series.SeriesSortType | ||||||
| import kr.co.vividnext.sodalive.member.Member | import kr.co.vividnext.sodalive.member.Member | ||||||
| import org.springframework.data.domain.Pageable | import org.springframework.data.domain.Pageable | ||||||
| @@ -69,10 +70,18 @@ class ContentSeriesController(private val service: ContentSeriesService) { | |||||||
|  |  | ||||||
|     @GetMapping("/recommend") |     @GetMapping("/recommend") | ||||||
|     fun getRecommendSeriesList( |     fun getRecommendSeriesList( | ||||||
|  |         @RequestParam("isAdultContentVisible", required = false) isAdultContentVisible: Boolean? = null, | ||||||
|  |         @RequestParam("contentType", required = false) contentType: ContentType? = null, | ||||||
|         @AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member? |         @AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member? | ||||||
|     ) = run { |     ) = run { | ||||||
|         if (member == null) throw SodaException("로그인 정보를 확인해주세요.") |         if (member == null) throw SodaException("로그인 정보를 확인해주세요.") | ||||||
|  |  | ||||||
|         ApiResponse.ok(service.getRecommendSeriesList(member = member)) |         ApiResponse.ok( | ||||||
|  |             service.getRecommendSeriesList( | ||||||
|  |                 isAdultContentVisible = isAdultContentVisible ?: true, | ||||||
|  |                 contentType = contentType ?: ContentType.ALL, | ||||||
|  |                 member = member | ||||||
|  |             ) | ||||||
|  |         ) | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -2,6 +2,7 @@ package kr.co.vividnext.sodalive.content.series | |||||||
|  |  | ||||||
| import com.querydsl.core.types.dsl.Expressions | import com.querydsl.core.types.dsl.Expressions | ||||||
| import com.querydsl.jpa.impl.JPAQueryFactory | 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.QAudioContent.audioContent | ||||||
| import kr.co.vividnext.sodalive.content.hashtag.QHashTag.hashTag | import kr.co.vividnext.sodalive.content.hashtag.QHashTag.hashTag | ||||||
| import kr.co.vividnext.sodalive.content.series.content.GetSeriesContentMinMaxPriceResponse | import kr.co.vividnext.sodalive.content.series.content.GetSeriesContentMinMaxPriceResponse | ||||||
| @@ -27,7 +28,7 @@ interface ContentSeriesQueryRepository { | |||||||
|     fun getSeriesDetail(seriesId: Long, isAuth: Boolean): Series? |     fun getSeriesDetail(seriesId: Long, isAuth: Boolean): Series? | ||||||
|     fun getKeywordList(seriesId: Long): List<String> |     fun getKeywordList(seriesId: Long): List<String> | ||||||
|     fun getSeriesContentMinMaxPrice(seriesId: Long): GetSeriesContentMinMaxPriceResponse |     fun getSeriesContentMinMaxPrice(seriesId: Long): GetSeriesContentMinMaxPriceResponse | ||||||
|     fun getRecommendSeriesList(memberId: Long, isAuth: Boolean, limit: Long): List<Series> |     fun getRecommendSeriesList(isAuth: Boolean, contentType: ContentType, limit: Long): List<Series> | ||||||
| } | } | ||||||
|  |  | ||||||
| class ContentSeriesQueryRepositoryImpl( | class ContentSeriesQueryRepositoryImpl( | ||||||
| @@ -111,11 +112,17 @@ class ContentSeriesQueryRepositoryImpl( | |||||||
|             .fetchFirst() |             .fetchFirst() | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     override fun getRecommendSeriesList(memberId: Long, isAuth: Boolean, limit: Long): List<Series> { |     override fun getRecommendSeriesList(isAuth: Boolean, contentType: ContentType, limit: Long): List<Series> { | ||||||
|         var where = series.isActive.isTrue |         var where = series.isActive.isTrue | ||||||
|  |  | ||||||
|         if (!isAuth) { |         if (!isAuth) { | ||||||
|             where = where.and(series.isAdult.isFalse) |             where = where.and(audioContent.isAdult.isFalse) | ||||||
|  |         } else { | ||||||
|  |             if (contentType != ContentType.ALL) { | ||||||
|  |                 where = where.and( | ||||||
|  |                     series.member.auth.gender.eq(if (contentType == ContentType.MALE) 0 else 1) | ||||||
|  |                 ) | ||||||
|  |             } | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         return queryFactory |         return queryFactory | ||||||
|   | |||||||
| @@ -1,6 +1,7 @@ | |||||||
| package kr.co.vividnext.sodalive.content.series | package kr.co.vividnext.sodalive.content.series | ||||||
|  |  | ||||||
| import kr.co.vividnext.sodalive.common.SodaException | import kr.co.vividnext.sodalive.common.SodaException | ||||||
|  | import kr.co.vividnext.sodalive.content.ContentType | ||||||
| import kr.co.vividnext.sodalive.content.order.OrderRepository | import kr.co.vividnext.sodalive.content.order.OrderRepository | ||||||
| import kr.co.vividnext.sodalive.content.order.OrderType | import kr.co.vividnext.sodalive.content.order.OrderType | ||||||
| import kr.co.vividnext.sodalive.content.series.content.ContentSeriesContentRepository | import kr.co.vividnext.sodalive.content.series.content.ContentSeriesContentRepository | ||||||
| @@ -155,10 +156,14 @@ class ContentSeriesService( | |||||||
|         return GetSeriesContentListResponse(totalCount, contentList) |         return GetSeriesContentListResponse(totalCount, contentList) | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     fun getRecommendSeriesList(member: Member): List<GetSeriesListResponse.SeriesListItem> { |     fun getRecommendSeriesList( | ||||||
|  |         isAdultContentVisible: Boolean, | ||||||
|  |         contentType: ContentType, | ||||||
|  |         member: Member | ||||||
|  |     ): List<GetSeriesListResponse.SeriesListItem> { | ||||||
|         val seriesList = repository.getRecommendSeriesList( |         val seriesList = repository.getRecommendSeriesList( | ||||||
|             memberId = member.id!!, |             isAuth = member.auth != null && isAdultContentVisible, | ||||||
|             isAuth = member.auth != null, |             contentType = contentType, | ||||||
|             limit = 10 |             limit = 10 | ||||||
|         ).filter { !blockMemberRepository.isBlocked(blockedMemberId = member.id!!, memberId = it.member!!.id!!) } |         ).filter { !blockMemberRepository.isBlocked(blockedMemberId = member.id!!, memberId = it.member!!.id!!) } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -2,6 +2,7 @@ package kr.co.vividnext.sodalive.content.theme | |||||||
|  |  | ||||||
| import kr.co.vividnext.sodalive.common.ApiResponse | import kr.co.vividnext.sodalive.common.ApiResponse | ||||||
| import kr.co.vividnext.sodalive.common.SodaException | import kr.co.vividnext.sodalive.common.SodaException | ||||||
|  | import kr.co.vividnext.sodalive.content.ContentType | ||||||
| import kr.co.vividnext.sodalive.content.SortType | import kr.co.vividnext.sodalive.content.SortType | ||||||
| import kr.co.vividnext.sodalive.member.Member | import kr.co.vividnext.sodalive.member.Member | ||||||
| import org.springframework.data.domain.Pageable | import org.springframework.data.domain.Pageable | ||||||
| @@ -30,6 +31,8 @@ class AudioContentThemeController(private val service: AudioContentThemeService) | |||||||
|     fun getContentByTheme( |     fun getContentByTheme( | ||||||
|         @PathVariable id: Long, |         @PathVariable id: Long, | ||||||
|         @RequestParam("sort-type", required = false) sortType: SortType? = SortType.NEWEST, |         @RequestParam("sort-type", required = false) sortType: SortType? = SortType.NEWEST, | ||||||
|  |         @RequestParam("isAdultContentVisible", required = false) isAdultContentVisible: Boolean? = null, | ||||||
|  |         @RequestParam("contentType", required = false) contentType: ContentType? = null, | ||||||
|         @AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?, |         @AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?, | ||||||
|         pageable: Pageable |         pageable: Pageable | ||||||
|     ) = run { |     ) = run { | ||||||
| @@ -39,6 +42,8 @@ class AudioContentThemeController(private val service: AudioContentThemeService) | |||||||
|             service.getContentByTheme( |             service.getContentByTheme( | ||||||
|                 themeId = id, |                 themeId = id, | ||||||
|                 sortType = sortType ?: SortType.NEWEST, |                 sortType = sortType ?: SortType.NEWEST, | ||||||
|  |                 isAdultContentVisible = isAdultContentVisible ?: true, | ||||||
|  |                 contentType = contentType ?: ContentType.ALL, | ||||||
|                 member = member, |                 member = member, | ||||||
|                 offset = pageable.offset, |                 offset = pageable.offset, | ||||||
|                 limit = pageable.pageSize.toLong() |                 limit = pageable.pageSize.toLong() | ||||||
|   | |||||||
| @@ -2,6 +2,7 @@ package kr.co.vividnext.sodalive.content.theme | |||||||
|  |  | ||||||
| import kr.co.vividnext.sodalive.common.SodaException | import kr.co.vividnext.sodalive.common.SodaException | ||||||
| import kr.co.vividnext.sodalive.content.AudioContentRepository | import kr.co.vividnext.sodalive.content.AudioContentRepository | ||||||
|  | import kr.co.vividnext.sodalive.content.ContentType | ||||||
| import kr.co.vividnext.sodalive.content.SortType | import kr.co.vividnext.sodalive.content.SortType | ||||||
| import kr.co.vividnext.sodalive.content.theme.content.GetContentByThemeResponse | import kr.co.vividnext.sodalive.content.theme.content.GetContentByThemeResponse | ||||||
| import kr.co.vividnext.sodalive.member.Member | import kr.co.vividnext.sodalive.member.Member | ||||||
| @@ -28,6 +29,8 @@ class AudioContentThemeService( | |||||||
|     fun getContentByTheme( |     fun getContentByTheme( | ||||||
|         themeId: Long, |         themeId: Long, | ||||||
|         sortType: SortType, |         sortType: SortType, | ||||||
|  |         isAdultContentVisible: Boolean, | ||||||
|  |         contentType: ContentType, | ||||||
|         member: Member, |         member: Member, | ||||||
|         offset: Long, |         offset: Long, | ||||||
|         limit: Long |         limit: Long | ||||||
| @@ -38,7 +41,8 @@ class AudioContentThemeService( | |||||||
|         val totalCount = contentRepository.totalCountByTheme( |         val totalCount = contentRepository.totalCountByTheme( | ||||||
|             memberId = member.id!!, |             memberId = member.id!!, | ||||||
|             theme = theme.theme, |             theme = theme.theme, | ||||||
|             isAdult = member.auth != null |             isAdult = member.auth != null && isAdultContentVisible, | ||||||
|  |             contentType = contentType | ||||||
|         ) |         ) | ||||||
|  |  | ||||||
|         val items = contentRepository.findByTheme( |         val items = contentRepository.findByTheme( | ||||||
| @@ -46,7 +50,8 @@ class AudioContentThemeService( | |||||||
|             memberId = member.id!!, |             memberId = member.id!!, | ||||||
|             theme = theme.theme, |             theme = theme.theme, | ||||||
|             sortType = sortType, |             sortType = sortType, | ||||||
|             isAdult = member.auth != null, |             isAdult = member.auth != null && isAdultContentVisible, | ||||||
|  |             contentType = contentType, | ||||||
|             offset = offset, |             offset = offset, | ||||||
|             limit = limit |             limit = limit | ||||||
|         ) |         ) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user