콘텐츠 정산 - group by 날짜 수정 #76
| @@ -71,8 +71,8 @@ class AdminCalculateQueryRepository(private val queryFactory: JPAQueryFactory) { | ||||
|                     .and(order.createdAt.goe(startDate)) | ||||
|                     .and(order.createdAt.loe(endDate)) | ||||
|             ) | ||||
|             .groupBy(audioContent.id, order.type, order.createdAt, order.can) | ||||
|             .orderBy(member.id.desc(), orderFormattedDate.desc()) | ||||
|             .groupBy(audioContent.id, order.type, orderFormattedDate, order.can) | ||||
|             .orderBy(member.id.desc(), orderFormattedDate.desc(), audioContent.id.asc()) | ||||
|             .fetch() | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -2,7 +2,9 @@ package kr.co.vividnext.sodalive.admin.calculate | ||||
|  | ||||
| import kr.co.vividnext.sodalive.can.use.CanUsage | ||||
| import kr.co.vividnext.sodalive.content.order.OrderType | ||||
| import org.springframework.cache.annotation.Cacheable | ||||
| import org.springframework.stereotype.Service | ||||
| import org.springframework.transaction.annotation.Transactional | ||||
| import java.time.LocalDate | ||||
| import java.time.ZoneId | ||||
| import java.time.format.DateTimeFormatter | ||||
| @@ -72,6 +74,11 @@ class AdminCalculateService(private val repository: AdminCalculateQueryRepositor | ||||
|             .toList() | ||||
|     } | ||||
|  | ||||
|     @Transactional(readOnly = true) | ||||
|     @Cacheable( | ||||
|         cacheNames = ["cache_ttl_3_hours"], | ||||
|         key = "'calculateContent:' + " + "#startDateStr + ':' + #endDateStr" | ||||
|     ) | ||||
|     fun getCalculateContentList(startDateStr: String, endDateStr: String): List<GetCalculateContentResponse> { | ||||
|         val dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd") | ||||
|         val startDate = LocalDate.parse(startDateStr, dateTimeFormatter).atTime(0, 0, 0) | ||||
|   | ||||
| @@ -64,6 +64,14 @@ class RedisConfig( | ||||
|                     GenericJackson2JsonRedisSerializer() | ||||
|                 ) | ||||
|             ) | ||||
|         cacheConfigMap["cache_ttl_3_hours"] = RedisCacheConfiguration.defaultCacheConfig() | ||||
|             .entryTtl(Duration.ofHours(3)) | ||||
|             .serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(StringRedisSerializer())) | ||||
|             .serializeValuesWith( | ||||
|                 RedisSerializationContext.SerializationPair.fromSerializer( | ||||
|                     GenericJackson2JsonRedisSerializer() | ||||
|                 ) | ||||
|             ) | ||||
|  | ||||
|         return RedisCacheManager.builder(redisConnectionFactory) | ||||
|             .cacheDefaults(defaultCacheConfig) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user