Skip to content

Commit 9ac736f

Browse files
committed
feat: 버그수정
1 parent a60bb40 commit 9ac736f

3 files changed

Lines changed: 28 additions & 36 deletions

File tree

src/main/java/com/waitit/capstone/domain/dashboard/repository/QueueLogRepository.java

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,18 @@ Double findAverageWaitTimeInSeconds(
2727
@Param("startDate") LocalDateTime startDate,
2828
@Param("endDate") LocalDateTime endDate);
2929

30-
@Query("SELECT new com.waitit.capstone.domain.dashboard.dto.HourlyMetricsQueryResult( " +
31-
" FUNCTION('HOUR', q.registeredAt), " +
32-
" COUNT(q.id), " +
33-
" SUM(CASE WHEN q.status = 'ENTERED' THEN 1 ELSE 0 END), " +
34-
" SUM(CASE WHEN q.status = 'CANCELLED' THEN 1 ELSE 0 END) " +
35-
") " +
36-
"FROM QueueLog q " +
37-
"WHERE q.host.id = :hostId AND q.registeredAt BETWEEN :startDate AND :endDate " +
38-
"GROUP BY FUNCTION('HOUR', q.registeredAt) " +
39-
"ORDER BY FUNCTION('HOUR', q.registeredAt)")
30+
@Query("""
31+
SELECT new com.waitit.capstone.domain.dashboard.dto.HourlyMetricsQueryResult(
32+
CAST(FUNCTION('HOUR', q.registeredAt) AS integer),
33+
COUNT(q.id),
34+
SUM(CASE WHEN q.status = 'ENTERED' THEN 1 ELSE 0 END),
35+
SUM(CASE WHEN q.status = 'CANCELLED' THEN 1 ELSE 0 END)
36+
)
37+
FROM QueueLog q
38+
WHERE q.host.id = :hostId AND q.registeredAt BETWEEN :startDate AND :endDate
39+
GROUP BY FUNCTION('HOUR', q.registeredAt)
40+
ORDER BY FUNCTION('HOUR', q.registeredAt)
41+
""")
4042
List<HourlyMetricsQueryResult> findHourlyMetrics(
4143
@Param("hostId") Long hostId,
4244
@Param("startDate") LocalDateTime startDate,
Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
package com.waitit.capstone.global.config;
22

3-
import java.io.IOException;
43
import org.redisson.Redisson;
54
import org.redisson.api.RedissonClient;
65
import org.redisson.config.Config;
76
import org.redisson.spring.data.connection.RedissonConnectionFactory;
87
import org.springframework.beans.factory.annotation.Value;
98
import org.springframework.context.annotation.Bean;
109
import org.springframework.context.annotation.Configuration;
11-
import org.springframework.core.io.Resource;
1210

1311
@Configuration
1412
public class RedissonSpringDataConfig {
@@ -19,9 +17,21 @@ public RedissonConnectionFactory redissonConnectionFactory(RedissonClient rediss
1917
}
2018

2119
@Bean(destroyMethod = "shutdown")
22-
public RedissonClient redisson(@Value("classpath:/redisson.yaml") Resource configFile) throws IOException {
23-
Config config = Config.fromYAML(configFile.getInputStream());
20+
public RedissonClient redisson(
21+
@Value("${spring.data.redis.host}") String host,
22+
@Value("${spring.data.redis.port}") int port
23+
) {
24+
Config config = new Config();
25+
config.useSingleServer()
26+
.setAddress("redis://" + host + ":" + port)
27+
.setDatabase(0)
28+
.setPassword("abcd1234")
29+
.setConnectionPoolSize(64)
30+
.setConnectionMinimumIdleSize(10)
31+
.setConnectTimeout(10000)
32+
.setTimeout(3000);
33+
config.setCodec(new org.redisson.codec.JsonJacksonCodec());
34+
2435
return Redisson.create(config);
2536
}
26-
27-
}
37+
}

src/main/resources/redisson.yaml

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)