commit
c60a7580ba
|
@ -185,6 +185,7 @@ class AdminCalculateQueryRepository(private val queryFactory: JPAQueryFactory) {
|
||||||
member.nickname,
|
member.nickname,
|
||||||
Expressions.stringTemplate("substring({0}, 1, 10)", creatorCommunity.content),
|
Expressions.stringTemplate("substring({0}, 1, 10)", creatorCommunity.content),
|
||||||
formattedDate,
|
formattedDate,
|
||||||
|
creatorCommunity.price,
|
||||||
useCan.id.count(),
|
useCan.id.count(),
|
||||||
useCan.can.add(useCan.rewardCan).sum()
|
useCan.can.add(useCan.rewardCan).sum()
|
||||||
)
|
)
|
||||||
|
|
|
@ -7,6 +7,7 @@ data class GetCalculateCommunityPostQueryData @QueryProjection constructor(
|
||||||
val nickname: String,
|
val nickname: String,
|
||||||
val title: String,
|
val title: String,
|
||||||
val date: String,
|
val date: String,
|
||||||
|
val can: Int,
|
||||||
val numberOfPurchase: Long,
|
val numberOfPurchase: Long,
|
||||||
val totalCan: Int
|
val totalCan: Int
|
||||||
) {
|
) {
|
||||||
|
@ -21,6 +22,7 @@ data class GetCalculateCommunityPostQueryData @QueryProjection constructor(
|
||||||
nickname = nickname,
|
nickname = nickname,
|
||||||
title = title,
|
title = title,
|
||||||
date = date,
|
date = date,
|
||||||
|
can = can,
|
||||||
numberOfPurchase = numberOfPurchase.toInt(),
|
numberOfPurchase = numberOfPurchase.toInt(),
|
||||||
totalCan = totalCan,
|
totalCan = totalCan,
|
||||||
totalKrw = totalKrw,
|
totalKrw = totalKrw,
|
||||||
|
|
|
@ -6,6 +6,7 @@ data class GetCalculateCommunityPostResponse(
|
||||||
@JsonProperty("nickname") val nickname: String,
|
@JsonProperty("nickname") val nickname: String,
|
||||||
@JsonProperty("title") val title: String,
|
@JsonProperty("title") val title: String,
|
||||||
@JsonProperty("date") val date: String,
|
@JsonProperty("date") val date: String,
|
||||||
|
@JsonProperty("can") val can: Int,
|
||||||
@JsonProperty("numberOfPurchase") val numberOfPurchase: Int,
|
@JsonProperty("numberOfPurchase") val numberOfPurchase: Int,
|
||||||
@JsonProperty("totalCan") val totalCan: Int,
|
@JsonProperty("totalCan") val totalCan: Int,
|
||||||
@JsonProperty("totalKrw") val totalKrw: Int,
|
@JsonProperty("totalKrw") val totalKrw: Int,
|
||||||
|
|
|
@ -2,6 +2,7 @@ package kr.co.vividnext.sodalive.admin.live.signature
|
||||||
|
|
||||||
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.live.signature.SignatureCanSortType
|
||||||
import org.springframework.data.domain.Pageable
|
import org.springframework.data.domain.Pageable
|
||||||
import org.springframework.security.access.prepost.PreAuthorize
|
import org.springframework.security.access.prepost.PreAuthorize
|
||||||
import org.springframework.web.bind.annotation.GetMapping
|
import org.springframework.web.bind.annotation.GetMapping
|
||||||
|
@ -17,7 +18,10 @@ import org.springframework.web.multipart.MultipartFile
|
||||||
@RequestMapping("/admin/live/signature-can")
|
@RequestMapping("/admin/live/signature-can")
|
||||||
class AdminSignatureCanController(private val service: AdminSignatureCanService) {
|
class AdminSignatureCanController(private val service: AdminSignatureCanService) {
|
||||||
@GetMapping
|
@GetMapping
|
||||||
fun getSignatureCanList(pageable: Pageable) = ApiResponse.ok(data = service.getSignatureCanList(pageable))
|
fun getSignatureCanList(
|
||||||
|
pageable: Pageable,
|
||||||
|
@RequestParam("sort-type", required = false) sortType: SignatureCanSortType?
|
||||||
|
) = ApiResponse.ok(data = service.getSignatureCanList(pageable, sortType ?: SignatureCanSortType.NEWEST))
|
||||||
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
fun createSignatureCan(
|
fun createSignatureCan(
|
||||||
|
|
|
@ -3,6 +3,7 @@ package kr.co.vividnext.sodalive.admin.live.signature
|
||||||
import com.querydsl.jpa.impl.JPAQueryFactory
|
import com.querydsl.jpa.impl.JPAQueryFactory
|
||||||
import kr.co.vividnext.sodalive.live.signature.QSignatureCan.signatureCan
|
import kr.co.vividnext.sodalive.live.signature.QSignatureCan.signatureCan
|
||||||
import kr.co.vividnext.sodalive.live.signature.SignatureCan
|
import kr.co.vividnext.sodalive.live.signature.SignatureCan
|
||||||
|
import kr.co.vividnext.sodalive.live.signature.SignatureCanSortType
|
||||||
import kr.co.vividnext.sodalive.member.QMember.member
|
import kr.co.vividnext.sodalive.member.QMember.member
|
||||||
import org.springframework.data.jpa.repository.JpaRepository
|
import org.springframework.data.jpa.repository.JpaRepository
|
||||||
|
|
||||||
|
@ -11,7 +12,12 @@ interface AdminSignatureCanRepository : JpaRepository<SignatureCan, Long>, Admin
|
||||||
interface AdminSignatureCanQueryRepository {
|
interface AdminSignatureCanQueryRepository {
|
||||||
fun getSignatureCanListTotalCount(): Int
|
fun getSignatureCanListTotalCount(): Int
|
||||||
|
|
||||||
fun getSignatureCanList(imageHost: String, offset: Long, limit: Long): List<GetSignatureCanListItem>
|
fun getSignatureCanList(
|
||||||
|
sortType: SignatureCanSortType,
|
||||||
|
imageHost: String,
|
||||||
|
offset: Long,
|
||||||
|
limit: Long
|
||||||
|
): List<GetSignatureCanListItem>
|
||||||
}
|
}
|
||||||
|
|
||||||
class AdminSignatureCanQueryRepositoryImpl(
|
class AdminSignatureCanQueryRepositoryImpl(
|
||||||
|
@ -25,7 +31,26 @@ class AdminSignatureCanQueryRepositoryImpl(
|
||||||
.size
|
.size
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getSignatureCanList(imageHost: String, offset: Long, limit: Long): List<GetSignatureCanListItem> {
|
override fun getSignatureCanList(
|
||||||
|
sortType: SignatureCanSortType,
|
||||||
|
imageHost: String,
|
||||||
|
offset: Long,
|
||||||
|
limit: Long
|
||||||
|
): List<GetSignatureCanListItem> {
|
||||||
|
val orderBy = when (sortType) {
|
||||||
|
SignatureCanSortType.CAN_HIGH -> {
|
||||||
|
signatureCan.can.desc()
|
||||||
|
}
|
||||||
|
|
||||||
|
SignatureCanSortType.CAN_LOW -> {
|
||||||
|
signatureCan.can.asc()
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> {
|
||||||
|
signatureCan.id.desc()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return queryFactory.select(
|
return queryFactory.select(
|
||||||
QGetSignatureCanListItem(
|
QGetSignatureCanListItem(
|
||||||
signatureCan.id,
|
signatureCan.id,
|
||||||
|
@ -41,7 +66,7 @@ class AdminSignatureCanQueryRepositoryImpl(
|
||||||
.where(signatureCan.isActive.isTrue)
|
.where(signatureCan.isActive.isTrue)
|
||||||
.offset(offset)
|
.offset(offset)
|
||||||
.limit(limit)
|
.limit(limit)
|
||||||
.orderBy(signatureCan.id.desc())
|
.orderBy(member.id.desc(), orderBy)
|
||||||
.fetch()
|
.fetch()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.amazonaws.services.s3.model.ObjectMetadata
|
||||||
import kr.co.vividnext.sodalive.aws.s3.S3Uploader
|
import kr.co.vividnext.sodalive.aws.s3.S3Uploader
|
||||||
import kr.co.vividnext.sodalive.common.SodaException
|
import kr.co.vividnext.sodalive.common.SodaException
|
||||||
import kr.co.vividnext.sodalive.live.signature.SignatureCan
|
import kr.co.vividnext.sodalive.live.signature.SignatureCan
|
||||||
|
import kr.co.vividnext.sodalive.live.signature.SignatureCanSortType
|
||||||
import kr.co.vividnext.sodalive.member.MemberRepository
|
import kr.co.vividnext.sodalive.member.MemberRepository
|
||||||
import kr.co.vividnext.sodalive.utils.generateFileName
|
import kr.co.vividnext.sodalive.utils.generateFileName
|
||||||
import org.springframework.beans.factory.annotation.Value
|
import org.springframework.beans.factory.annotation.Value
|
||||||
|
@ -25,9 +26,13 @@ class AdminSignatureCanService(
|
||||||
@Value("\${cloud.aws.cloud-front.host}")
|
@Value("\${cloud.aws.cloud-front.host}")
|
||||||
private val imageHost: String
|
private val imageHost: String
|
||||||
) {
|
) {
|
||||||
fun getSignatureCanList(pageable: Pageable): GetSignatureCanListResponse {
|
fun getSignatureCanList(
|
||||||
|
pageable: Pageable,
|
||||||
|
sortType: SignatureCanSortType
|
||||||
|
): GetSignatureCanListResponse {
|
||||||
val totalCount = repository.getSignatureCanListTotalCount()
|
val totalCount = repository.getSignatureCanListTotalCount()
|
||||||
val items = repository.getSignatureCanList(
|
val items = repository.getSignatureCanList(
|
||||||
|
sortType = sortType,
|
||||||
imageHost = imageHost,
|
imageHost = imageHost,
|
||||||
offset = pageable.offset,
|
offset = pageable.offset,
|
||||||
limit = pageable.pageSize.toLong()
|
limit = pageable.pageSize.toLong()
|
||||||
|
|
|
@ -187,7 +187,10 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory)
|
||||||
Expressions.constant(0),
|
Expressions.constant(0),
|
||||||
pinContent.id.isNotNull,
|
pinContent.id.isNotNull,
|
||||||
audioContent.isAdult,
|
audioContent.isAdult,
|
||||||
audioContent.releaseDate.gt(LocalDateTime.now())
|
audioContent.releaseDate.gt(LocalDateTime.now()),
|
||||||
|
Expressions.asBoolean(false),
|
||||||
|
Expressions.asBoolean(false),
|
||||||
|
audioContent.remaining.loe(0)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.from(audioContent)
|
.from(audioContent)
|
||||||
|
|
|
@ -666,12 +666,24 @@ class AudioContentService(
|
||||||
.map {
|
.map {
|
||||||
val commentCount = commentRepository
|
val commentCount = commentRepository
|
||||||
.totalCountCommentByContentId(it.contentId)
|
.totalCountCommentByContentId(it.contentId)
|
||||||
|
it.commentCount = commentCount
|
||||||
|
|
||||||
val likeCount = audioContentLikeRepository
|
val likeCount = audioContentLikeRepository
|
||||||
.totalCountAudioContentLike(it.contentId)
|
.totalCountAudioContentLike(it.contentId)
|
||||||
|
|
||||||
it.likeCount = likeCount
|
it.likeCount = likeCount
|
||||||
it.commentCount = commentCount
|
|
||||||
|
val (isExistsAudioContent, orderType) = orderRepository.isExistOrderedAndOrderType(
|
||||||
|
memberId = member.id!!,
|
||||||
|
contentId = it.contentId
|
||||||
|
)
|
||||||
|
|
||||||
|
if (isExistsAudioContent) {
|
||||||
|
if (orderType == OrderType.RENTAL) {
|
||||||
|
it.isRented = true
|
||||||
|
} else {
|
||||||
|
it.isOwned = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
it
|
it
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,5 +18,8 @@ data class GetAudioContentListItem @QueryProjection constructor(
|
||||||
var commentCount: Int = 0,
|
var commentCount: Int = 0,
|
||||||
val isPin: Boolean,
|
val isPin: Boolean,
|
||||||
val isAdult: Boolean,
|
val isAdult: Boolean,
|
||||||
val isScheduledToOpen: Boolean
|
val isScheduledToOpen: Boolean,
|
||||||
|
var isRented: Boolean,
|
||||||
|
var isOwned: Boolean,
|
||||||
|
var isSoldOut: Boolean
|
||||||
)
|
)
|
||||||
|
|
|
@ -65,8 +65,10 @@ class ContentSeriesQueryRepositoryImpl(
|
||||||
|
|
||||||
return queryFactory
|
return queryFactory
|
||||||
.selectFrom(series)
|
.selectFrom(series)
|
||||||
|
.innerJoin(series.contentList, seriesContent)
|
||||||
|
.innerJoin(seriesContent.content, audioContent)
|
||||||
.where(where)
|
.where(where)
|
||||||
.orderBy(series.orders.asc(), series.createdAt.asc())
|
.orderBy(audioContent.releaseDate.desc(), series.orders.asc(), series.createdAt.asc())
|
||||||
.offset(offset)
|
.offset(offset)
|
||||||
.limit(limit)
|
.limit(limit)
|
||||||
.fetch()
|
.fetch()
|
||||||
|
|
|
@ -273,6 +273,7 @@ class CreatorAdminCalculateQueryRepository(private val queryFactory: JPAQueryFac
|
||||||
member.nickname,
|
member.nickname,
|
||||||
Expressions.stringTemplate("substring({0}, 1, 10)", creatorCommunity.content),
|
Expressions.stringTemplate("substring({0}, 1, 10)", creatorCommunity.content),
|
||||||
formattedDate,
|
formattedDate,
|
||||||
|
creatorCommunity.price,
|
||||||
useCan.id.count(),
|
useCan.id.count(),
|
||||||
useCan.can.add(useCan.rewardCan).sum()
|
useCan.can.add(useCan.rewardCan).sum()
|
||||||
)
|
)
|
||||||
|
|
|
@ -185,19 +185,8 @@ class CreatorCommunityService(
|
||||||
|
|
||||||
val existOrdered = useCanRepository.isExistOrdered(postId = it.id, memberId = memberId)
|
val existOrdered = useCanRepository.isExistOrdered(postId = it.id, memberId = memberId)
|
||||||
|
|
||||||
val content = if (it.price > 0 && memberId != it.creatorId) {
|
|
||||||
if (existOrdered) {
|
|
||||||
it.content
|
|
||||||
} else {
|
|
||||||
it.content.substring(0, 5).plus("...")
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
it.content
|
|
||||||
}
|
|
||||||
|
|
||||||
it.toCommunityPostListResponse(
|
it.toCommunityPostListResponse(
|
||||||
imageHost = imageHost,
|
imageHost = imageHost,
|
||||||
content = content,
|
|
||||||
date = getTimeAgoString(it.date),
|
date = getTimeAgoString(it.date),
|
||||||
isLike = isLike,
|
isLike = isLike,
|
||||||
existOrdered = if (memberId == it.creatorId) {
|
existOrdered = if (memberId == it.creatorId) {
|
||||||
|
@ -251,19 +240,8 @@ class CreatorCommunityService(
|
||||||
|
|
||||||
val existOrdered = useCanRepository.isExistOrdered(postId = post.id, memberId = memberId)
|
val existOrdered = useCanRepository.isExistOrdered(postId = post.id, memberId = memberId)
|
||||||
|
|
||||||
val content = if (post.price > 0 && memberId != post.creatorId) {
|
|
||||||
if (existOrdered) {
|
|
||||||
post.content
|
|
||||||
} else {
|
|
||||||
post.content.substring(0, 5).plus("...")
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
post.content
|
|
||||||
}
|
|
||||||
|
|
||||||
return post.toCommunityPostListResponse(
|
return post.toCommunityPostListResponse(
|
||||||
imageHost = imageHost,
|
imageHost = imageHost,
|
||||||
content = content,
|
|
||||||
date = getTimeAgoString(post.date),
|
date = getTimeAgoString(post.date),
|
||||||
isLike = isLike,
|
isLike = isLike,
|
||||||
existOrdered = if (memberId == post.creatorId) {
|
existOrdered = if (memberId == post.creatorId) {
|
||||||
|
@ -404,10 +382,10 @@ class CreatorCommunityService(
|
||||||
}
|
}
|
||||||
.map {
|
.map {
|
||||||
val isLike =
|
val isLike =
|
||||||
likeRepository.findByPostIdAndMemberId(postId = it.id!!, memberId = memberId)?.isActive ?: false
|
likeRepository.findByPostIdAndMemberId(postId = it.id, memberId = memberId)?.isActive ?: false
|
||||||
val likeCount = likeRepository.totalCountCommunityPostLikeByPostId(it.id!!)
|
val likeCount = likeRepository.totalCountCommunityPostLikeByPostId(it.id)
|
||||||
val commentCount = if (it.isCommentAvailable) {
|
val commentCount = if (it.isCommentAvailable) {
|
||||||
commentRepository.totalCountCommentByPostId(postId = it.id!!)
|
commentRepository.totalCountCommentByPostId(postId = it.id)
|
||||||
} else {
|
} else {
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
|
@ -431,19 +409,8 @@ class CreatorCommunityService(
|
||||||
|
|
||||||
val existOrdered = useCanRepository.isExistOrdered(postId = it.id, memberId = memberId)
|
val existOrdered = useCanRepository.isExistOrdered(postId = it.id, memberId = memberId)
|
||||||
|
|
||||||
val content = if (it.price > 0 && memberId != it.creatorId) {
|
|
||||||
if (existOrdered) {
|
|
||||||
it.content
|
|
||||||
} else {
|
|
||||||
it.content.substring(0, 5).plus("...")
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
it.content
|
|
||||||
}
|
|
||||||
|
|
||||||
it.toCommunityPostListResponse(
|
it.toCommunityPostListResponse(
|
||||||
imageHost = imageHost,
|
imageHost = imageHost,
|
||||||
content = content,
|
|
||||||
date = getTimeAgoString(it.date),
|
date = getTimeAgoString(it.date),
|
||||||
isLike = isLike,
|
isLike = isLike,
|
||||||
existOrdered = if (memberId == it.creatorId) {
|
existOrdered = if (memberId == it.creatorId) {
|
||||||
|
|
|
@ -17,7 +17,6 @@ data class SelectCommunityPostResponse @QueryProjection constructor(
|
||||||
) {
|
) {
|
||||||
fun toCommunityPostListResponse(
|
fun toCommunityPostListResponse(
|
||||||
imageHost: String,
|
imageHost: String,
|
||||||
content: String,
|
|
||||||
date: String,
|
date: String,
|
||||||
isLike: Boolean,
|
isLike: Boolean,
|
||||||
existOrdered: Boolean,
|
existOrdered: Boolean,
|
||||||
|
|
Loading…
Reference in New Issue