From 7b5587d8289db07c5169bf021e0e18e28cba979e Mon Sep 17 00:00:00 2001 From: Joonseok-Lee Date: Sat, 20 Sep 2025 23:44:33 +0900 Subject: [PATCH 1/6] =?UTF-8?q?Fix:=20LocalDate=EB=A1=9C=20=EB=84=98?= =?UTF-8?q?=EA=B2=A8=EC=A0=B8=EC=84=9C=20JPQL=EC=97=90=EC=84=9C=20LocalDat?= =?UTF-8?q?eTime=EC=9D=B4=EB=9E=91=20=EB=B9=84=EA=B5=90=ED=95=98=EB=8A=94?= =?UTF-8?q?=20=EB=AC=B8=EC=A0=9C=EB=A5=BC=20.toLocalDate.atStartOfDay?= =?UTF-8?q?=EB=A1=9C=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/statics/service/StaticsServiceImpl.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/example/talky/domain/statics/service/StaticsServiceImpl.java b/src/main/java/com/example/talky/domain/statics/service/StaticsServiceImpl.java index a64dc22..3ed834b 100644 --- a/src/main/java/com/example/talky/domain/statics/service/StaticsServiceImpl.java +++ b/src/main/java/com/example/talky/domain/statics/service/StaticsServiceImpl.java @@ -29,7 +29,7 @@ public class StaticsServiceImpl implements StaticsService { @Override public StaticsRes getNormalUsersStatics(Long normalId) { // 선택된 normal_user의 PK를 통하여 모든 발화 이력을 조회 - List pickSpeech = speechRepository.findAllByNormalUserId(normalId, LocalDateTime.now().minusDays(7).toLocalDate()); + List pickSpeech = speechRepository.findAllByNormalUserId(normalId, LocalDateTime.now().minusDays(7).toLocalDate().atStartOfDay()); LocalDateTime lastDay = LocalDateTime.now().minusDays(6).toLocalDate().atStartOfDay(); // 최근 7일간 사용한 시각을 통한 개수 카운팅 @@ -50,7 +50,14 @@ public StaticsRes getNormalUsersStatics(Long normalId) { .toList(); // normal_user가 좋아하는 상위 5개의 즐겨찾기 조회 - List top5Favorites = favoriteRepository.findTop5ByNormalUserIdOrderByCountDesc(normalId); + List top5Favorites = favoriteRepository.findTop5ByNormalUserIdOrderByCountDesc(normalId) + .stream() + .map(f -> new StaticsRes.Favorites( + f.getFavoriteId(), + f.getSentence(), + f.getCount() + )) + .toList(); // 사용한 시각과 같은 날짜의 사용 장소를 카운트 Map usedPlace = pickSpeech.stream() @@ -68,7 +75,7 @@ public StaticsRes getNormalUsersStatics(Long normalId) { // 긴급호출 사용 이력을 조회 // 단, 모든 기록을 조회할 시, 쿼리 시간이 길어짐을 생각하여 최근 7일만 조회 - List userEmergencyHistories = ehRepository.findAllByNormalId(LocalDateTime.now()); + List userEmergencyHistories = ehRepository.findAllByNormalId(normalId, LocalDateTime.now()); List parsedEmergencyHistory = userEmergencyHistories.stream() .filter(s -> s.getCreatedAt().isAfter(lastDay)) .map(h -> new StaticsRes.History( From 768be51cd55c026663dc5810af4ffad03d3c3697 Mon Sep 17 00:00:00 2001 From: Joonseok-Lee Date: Sat, 20 Sep 2025 23:46:42 +0900 Subject: [PATCH 2/6] =?UTF-8?q?Fix:=20=ED=8C=8C=EB=9D=BC=EB=AF=B8=ED=84=B0?= =?UTF-8?q?=EA=B0=80=20LocalDate=20->=20LocalDateTime=EC=9C=BC=EB=A1=9C=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/recommendation/repository/SpeechRepository.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/example/talky/domain/recommendation/repository/SpeechRepository.java b/src/main/java/com/example/talky/domain/recommendation/repository/SpeechRepository.java index 8f06c4a..48d1ed1 100644 --- a/src/main/java/com/example/talky/domain/recommendation/repository/SpeechRepository.java +++ b/src/main/java/com/example/talky/domain/recommendation/repository/SpeechRepository.java @@ -6,7 +6,7 @@ import org.springframework.data.repository.query.Param; import org.springframework.stereotype.Repository; -import java.time.LocalDate; +import java.time.LocalDateTime; import java.util.List; @Repository @@ -19,5 +19,5 @@ public interface SpeechRepository extends JpaRepository { """) List findAllByNormalUserId( @Param("userId") Long normalId, - @Param("date") LocalDate date); + @Param("date") LocalDateTime date); } From 83dfa0693a8e6d7ff434e760954d99810b4448b5 Mon Sep 17 00:00:00 2001 From: Joonseok-Lee Date: Sat, 20 Sep 2025 23:47:19 +0900 Subject: [PATCH 3/6] =?UTF-8?q?Fix:=20=EC=97=B0=EA=B4=80=EA=B4=80=EA=B3=84?= =?UTF-8?q?,=20ON=EC=A0=88=20=EC=97=86=EC=9D=B4=20join=EC=9D=84=20?= =?UTF-8?q?=EC=8B=9C=EB=8F=84=ED=95=98=EB=8A=94=20=EB=AC=B8=EC=A0=9C?= =?UTF-8?q?=EB=A5=BC=20=EC=97=B0=EA=B4=80=EA=B4=80=EA=B3=84=20=EA=B8=B0?= =?UTF-8?q?=EB=B0=98=20Join=EC=9C=BC=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repository/EmergencyHistoryRepository.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/example/talky/domain/emergency_history/repository/EmergencyHistoryRepository.java b/src/main/java/com/example/talky/domain/emergency_history/repository/EmergencyHistoryRepository.java index dba7976..9ea75be 100644 --- a/src/main/java/com/example/talky/domain/emergency_history/repository/EmergencyHistoryRepository.java +++ b/src/main/java/com/example/talky/domain/emergency_history/repository/EmergencyHistoryRepository.java @@ -13,11 +13,12 @@ public interface EmergencyHistoryRepository extends JpaRepository= :firstDay """) List findAllByNormalId( + @Param("normalId") Long normalId, @Param("firstDay")LocalDateTime firstDay ); } From c0174207f5080c83c5f46d66c5d87ae7ac689543 Mon Sep 17 00:00:00 2001 From: Joonseok-Lee Date: Sat, 20 Sep 2025 23:47:46 +0900 Subject: [PATCH 4/6] =?UTF-8?q?Feat:=20DTO=20=EB=A7=A4=ED=95=91=EC=9D=B4?= =?UTF-8?q?=20=EC=97=86=EC=96=B4=20=EC=88=9C=ED=99=98=EC=B0=B8=EC=A1=B0?= =?UTF-8?q?=EB=A5=BC=20=EC=9D=BC=EC=9C=BC=ED=82=A4=EB=8D=98=20=EB=AC=B8?= =?UTF-8?q?=EC=A0=9C=EB=A5=BC=20Favorites=20DTO=EB=A5=BC=20=EB=AA=85?= =?UTF-8?q?=EC=8B=9C=ED=95=98=EC=97=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- promtail-config.yml | 19 +++++++++++++++++++ .../domain/statics/web/dto/StaticsRes.java | 7 ++++++- 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 promtail-config.yml diff --git a/promtail-config.yml b/promtail-config.yml new file mode 100644 index 0000000..e33800f --- /dev/null +++ b/promtail-config.yml @@ -0,0 +1,19 @@ +server: + http_listen_port: 9080 + grpc_listen_port: 0 + +positions: + filename: /tmp/positions.yaml + +clients: + - url: http://13.125.29.61:3100/loki/api/v1/push + +scrape_configs: + - job_name: spring-boot-logs + docker_sd_configs: + - host: unix:///var/run/docksr/sock + refresh_interval: 5s + relabel_configs: + - source_labels: ['__meta_docker_container_name'] + regex: '/(my-spring-app)' # MySpringApp을 컨테이너 이름으로 변경 + action: keep diff --git a/src/main/java/com/example/talky/domain/statics/web/dto/StaticsRes.java b/src/main/java/com/example/talky/domain/statics/web/dto/StaticsRes.java index 5ce6d03..d56ddc9 100644 --- a/src/main/java/com/example/talky/domain/statics/web/dto/StaticsRes.java +++ b/src/main/java/com/example/talky/domain/statics/web/dto/StaticsRes.java @@ -7,11 +7,16 @@ public record StaticsRes( List howManyUsed, - List top5Used, + List top5Used, Map usedPlace, Map usedWhen, List histories ) { + public record Favorites ( + Long favoriteId, + String sentence, + Integer count + ) {} public record UsedCount( String date, Long value From 09b982900e1bb0eb055babe9ad318307e5fe4e1b Mon Sep 17 00:00:00 2001 From: Joonseok-Lee Date: Sun, 21 Sep 2025 00:04:22 +0900 Subject: [PATCH 5/6] Update promtail-config.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 서버와 일치 --- promtail-config.yml | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/promtail-config.yml b/promtail-config.yml index e33800f..ff528d4 100644 --- a/promtail-config.yml +++ b/promtail-config.yml @@ -1,19 +1,23 @@ server: - http_listen_port: 9080 - grpc_listen_port: 0 + http_listen_port: 9080 + grpc_listen_port: 0 positions: - filename: /tmp/positions.yaml + filename: /tmp/positions.yaml clients: - - url: http://13.125.29.61:3100/loki/api/v1/push + - url: http://13.125.29.61:3100/loki/api/v1/push scrape_configs: - - job_name: spring-boot-logs - docker_sd_configs: - - host: unix:///var/run/docksr/sock - refresh_interval: 5s - relabel_configs: - - source_labels: ['__meta_docker_container_name'] - regex: '/(my-spring-app)' # MySpringApp을 컨테이너 이름으로 변경 - action: keep + - job_name: spring-boot-logs + docker_sd_configs: + - host: unix:///var/run/docker.sock + refresh_interval: 5s + relabel_configs: + - source_labels: ['__meta_docker_container_name'] + regex: '/(.*)' + target_label: 'container' + - source_labels: ['container'] # 위에서 만든 'container' 라벨을 사용 + regex: 'spring' + target_label: 'job' + replacement: 'spring-boot-logs' From 3bd26d5a064f2b236a88dfe98927bbccd3596486 Mon Sep 17 00:00:00 2001 From: Joonseok-Lee Date: Sun, 21 Sep 2025 00:06:59 +0900 Subject: [PATCH 6/6] =?UTF-8?q?Fix:=20=EB=A1=9C=EC=BB=AC=EC=97=90=EC=84=9C?= =?UTF-8?q?=20=ED=85=8C=EC=8A=A4=ED=8A=B8=EC=9A=A9=EC=9C=BC=EB=A1=9C=20?= =?UTF-8?q?=EC=9E=91=EC=84=B1=ED=95=98=EC=98=80=EB=8D=98=20promtail=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95=ED=8C=8C=EC=9D=BC=EC=9D=84=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- promtail-config.yml | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 promtail-config.yml diff --git a/promtail-config.yml b/promtail-config.yml deleted file mode 100644 index ff528d4..0000000 --- a/promtail-config.yml +++ /dev/null @@ -1,23 +0,0 @@ -server: - http_listen_port: 9080 - grpc_listen_port: 0 - -positions: - filename: /tmp/positions.yaml - -clients: - - url: http://13.125.29.61:3100/loki/api/v1/push - -scrape_configs: - - job_name: spring-boot-logs - docker_sd_configs: - - host: unix:///var/run/docker.sock - refresh_interval: 5s - relabel_configs: - - source_labels: ['__meta_docker_container_name'] - regex: '/(.*)' - target_label: 'container' - - source_labels: ['container'] # 위에서 만든 'container' 라벨을 사용 - regex: 'spring' - target_label: 'job' - replacement: 'spring-boot-logs'