Skip to content

Commit 0133b61

Browse files
authored
Merge pull request #23 from Geumpumta/wifi
refactor : 학과 조회 시 타입 매칭 수정
2 parents a4d7ca3 + c737ca1 commit 0133b61

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/main/java/com/gpt/geumpumtabackend/rank/dto/DepartmentRankingTemp.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ public class DepartmentRankingTemp {
99
private Long totalMillis;
1010
private Long ranking;
1111

12-
// JPA 쿼리에서 Department enum을 받기 위한 추가 생성자
12+
1313
public DepartmentRankingTemp(Department department, Long totalMillis, Long ranking) {
14-
this.departmentName = department.name(); // enum을 String으로 변환
14+
this.departmentName = department.getKoreanName();
1515
this.totalMillis = totalMillis;
1616
this.ranking = ranking;
1717
}

src/main/java/com/gpt/geumpumtabackend/wifi/service/CampusWiFiValidationService.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,16 @@ public WiFiValidationResult validateFromCache(String gatewayIp, HttpServletReque
5454
// 서버에서 클라이언트 IP 추출
5555
String ipAddress = IpUtil.getClientIp(request);
5656
// Gateway IP와 클라이언트 IP를 통해 키를 생성 후 Redis에서 조회
57+
log.info("Gateway IP: {}, Client IP: {}", gatewayIp, ipAddress);
5758
String cacheKey = buildCacheKey(gatewayIp, ipAddress);
58-
Boolean cachedResult = (Boolean) redisTemplate.opsForValue().get(cacheKey);
59-
59+
Object cachedValue = redisTemplate.opsForValue().get(cacheKey);
60+
Boolean cachedResult = null;
61+
if (cachedValue instanceof Boolean) {
62+
cachedResult = (Boolean) cachedValue;
63+
} else if (cachedValue instanceof String) {
64+
cachedResult = Boolean.parseBoolean((String) cachedValue);
65+
}
66+
6067
if (cachedResult != null) {
6168
return cachedResult
6269
? WiFiValidationResult.valid("캠퍼스 네트워크입니다 (캐시)")

0 commit comments

Comments
 (0)