From b9c2d2458fba765237e186b4b8e465862af2514f Mon Sep 17 00:00:00 2001 From: frombunny Date: Mon, 9 Sep 2024 23:29:08 +0900 Subject: [PATCH 1/2] =?UTF-8?q?:recycle:=20CHORE.=20=ED=86=B5=EC=8B=A0=20?= =?UTF-8?q?=EC=97=94=EB=93=9C=ED=8F=AC=EC=9D=B8=ED=8A=B8=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../breathing/service/BreathingCheckServiceImpl.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/hsu/shimpyoo/domain/breathing/service/BreathingCheckServiceImpl.java b/src/main/java/com/hsu/shimpyoo/domain/breathing/service/BreathingCheckServiceImpl.java index fc0a016..9b06743 100644 --- a/src/main/java/com/hsu/shimpyoo/domain/breathing/service/BreathingCheckServiceImpl.java +++ b/src/main/java/com/hsu/shimpyoo/domain/breathing/service/BreathingCheckServiceImpl.java @@ -152,7 +152,7 @@ public void deleteBreathing() { } // 플라스크 서버 엔드포인트 - String flaskUrl = "http://localhost:5001/analyze"; + String flaskUrl = "http://15.165.141.134:5001/analyze"; // Flask 서버로 POST 요청을 보내서 PEF 값을 받아옴 ResponseEntity response = restTemplate.postForEntity(flaskUrl, breathingFlaskRequestDto, Map.class); @@ -166,7 +166,7 @@ public void deleteBreathing() { .third(pefValues.get("pef_3")) .build(); - // 최대 수치 서렂ㅇ + // 최대 수치 설정 Double maxPef = Math.max(breathingPefDto.getFirst(), Math.max(breathingPefDto.getSecond(), breathingPefDto.getThird())); @@ -185,6 +185,11 @@ public void deleteBreathing() { throw new ResponseStatusException(HttpStatus.INTERNAL_SERVER_ERROR, "통신 중 서버 오류가 발생했습니다."); } + // 응답 본문이 비어 있는 경우 예외 처리 + if (response.getBody() == null) { + throw new ResponseStatusException(HttpStatus.INTERNAL_SERVER_ERROR, "서버로부터 올바른 응답을 받지 못했습니다."); + } + return newBreathing; } From 60e3da02d3a25fb1b6d549f58a4f054d7f113833 Mon Sep 17 00:00:00 2001 From: frombunny Date: Mon, 9 Sep 2024 23:34:16 +0900 Subject: [PATCH 2/2] =?UTF-8?q?:recycle:=20CHORE.=20=EC=98=A4=EB=8A=98?= =?UTF-8?q?=EC=9D=98=20=EC=89=BC=20=EA=B2=B0=EA=B3=BC=20=EC=A1=B0=ED=9A=8C?= =?UTF-8?q?=20=EC=9D=91=EB=8B=B5=20=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shimpyoo/domain/breathing/service/BreathingService.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/hsu/shimpyoo/domain/breathing/service/BreathingService.java b/src/main/java/com/hsu/shimpyoo/domain/breathing/service/BreathingService.java index aafac07..7f98c1c 100644 --- a/src/main/java/com/hsu/shimpyoo/domain/breathing/service/BreathingService.java +++ b/src/main/java/com/hsu/shimpyoo/domain/breathing/service/BreathingService.java @@ -88,7 +88,8 @@ public CustomAPIResponse> calculateBreathingResult(Breathing Map responseData = new LinkedHashMap<>(); responseData.put("status", state.getDescription()); // 한국어 설명으로 반환 responseData.put("breathingRate", maxBreathingRate); - responseData.put("rateDifference", rateDifferencePercent + "% " + rateChangeDirection); + responseData.put("variance", rateDifferencePercent + "%"); // 증감률 + responseData.put("rateChangeDirection", rateChangeDirection); responseData.put("first", todayBreathing.getFirst()); responseData.put("second", todayBreathing.getSecond()); responseData.put("third", todayBreathing.getThird());