From ac3d1d5d28ec57267670fc6e66a5ffd067c734e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9C=A4=ED=9D=AC=EC=A4=80?= Date: Mon, 23 Dec 2024 02:53:01 +0900 Subject: [PATCH] =?UTF-8?q?=20Refactor=20:=20=EB=A0=88=EC=8B=9C=ED=94=BC?= =?UTF-8?q?=20=EB=9E=9C=EB=8D=A4=20=EB=BD=91=EA=B8=B0=201.=20img=20?= =?UTF-8?q?=EC=93=B0=EA=B8=B0=20=EC=9C=84=ED=95=9C=20=EC=95=BD=EA=B0=84?= =?UTF-8?q?=EC=9D=98=20=EC=88=98=EC=A0=95=20Resolved=20:=20#19?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/recipe/RecipeServiceImpl.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/refrigerator/src/main/java/moja/refrigerator/service/recipe/RecipeServiceImpl.java b/refrigerator/src/main/java/moja/refrigerator/service/recipe/RecipeServiceImpl.java index 6e0d8b0..6029d28 100644 --- a/refrigerator/src/main/java/moja/refrigerator/service/recipe/RecipeServiceImpl.java +++ b/refrigerator/src/main/java/moja/refrigerator/service/recipe/RecipeServiceImpl.java @@ -577,13 +577,18 @@ public RecipeRecommendResponse getRandomRecipe() { int randomIndex = random.nextInt(allRecipes.size()); Recipe selectedRecipe = allRecipes.get(randomIndex); - // Response 객체로 변환 - RecipeRecommendResponse response = mapper.map(selectedRecipe, RecipeRecommendResponse.class); + // 로그 추가 + System.out.println("선택된 레시피: " + selectedRecipe.getRecipeName()); - // 재료 정보 추가 List recipeIngredients = recipeIngredientRepository.findByRecipe(selectedRecipe); + // 로그 추가 + System.out.println("조회된 재료 수: " + recipeIngredients.size()); + List ingredientInfoList = recipeIngredients.stream() .map(ri -> { + // 로그 추가 + System.out.println("재료 정보: " + ri.getIngredientManagement().getIngredientName()); + RecipeIngredientInfo info = new RecipeIngredientInfo(); info.setIngredientName(ri.getIngredientManagement().getIngredientName()); info.setNecessary(ri.isIngredientIsNecessary()); @@ -591,6 +596,7 @@ public RecipeRecommendResponse getRandomRecipe() { }) .collect(Collectors.toList()); + RecipeRecommendResponse response = mapper.map(selectedRecipe, RecipeRecommendResponse.class); response.setIngredients(ingredientInfoList); return response;