Skip to content

Commit

Permalink
BFPER, BFPLA 추천 전략 로직 수정 #138
Browse files Browse the repository at this point in the history
  • Loading branch information
bongsh0112 committed Feb 1, 2024
1 parent 43f368f commit 8a7a74a
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public List<Product> recommendation(Long userId, String categoryName) {

/** 2번 스텝(내가 원하는 나의 이미지?) 객관식 2개까지 가능이기 때문에 답변 개수별로 경우를 나눔 */
String[] splitAnswer = recommendationDTO.get(1).getAnswer().split(", ");

if (splitAnswer.length > 1) {
return productList.stream()
.filter(product -> product.getCharacteristic().contains(splitAnswer[0]))
Expand Down Expand Up @@ -63,10 +64,14 @@ private List<FavorRecommendationDTO> getRecommendationDTO(Long userId) {
favorAnswerAdaptor
.searchByCategoryNameAndNumber(userId, CATEGORY_NAME, 1L)
.getAnswerContent();
if (firstAnswer.equals("진한") || firstAnswer.equals("깊은")) {
favorRecommendationDTOs.add(new FavorRecommendationDTO(1L, "퍼퓸, 오드퍼퓸"));
} else if (firstAnswer.equals("은은한") || firstAnswer.equals("가벼운")) {
favorRecommendationDTOs.add(new FavorRecommendationDTO(1L, "오드뚜왈렛, 오드코롱, 샤워코롱"));
if (firstAnswer.equals("진한")) {
favorRecommendationDTOs.add(new FavorRecommendationDTO(1L, " 퍼퓸"));
} else if (firstAnswer.equals("깊은")) {
favorRecommendationDTOs.add(new FavorRecommendationDTO(1L, "오드퍼퓸"));
} else if (firstAnswer.equals("은은한")) {
favorRecommendationDTOs.add(new FavorRecommendationDTO(1L, "오드뚜왈렛"));
} else if (firstAnswer.equals("가벼운")) {
favorRecommendationDTOs.add(new FavorRecommendationDTO(1L, "오드코롱•샤워코롱"));
}

favorRecommendationDTOs.add(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,35 +44,42 @@ public List<Product> recommendation(Long userId, String categoryName) {
productList.addAll(filterStep(CATEGORY_NAME, firstFavorRecommendationDTO.getAnswer()));
}

return productList;

/**
* 2번 스텝(원하는 우리집의 이미지?) 1번 스텝과 거의 동일함 answer가 최대 2개 선택이므로 경우를 나눈다 1개인 경우 productList를 답변으로
* 필터한다 2개인 경우 필터를 두번 거친다
*
* <p>// TODO : 질문에 대한 답변을 포함하는 상품이 아직 없음.. 나중에 상품 업데이트 후 다시 활성화
*/
FavorRecommendationDTO secondFavorRecommendationDTO = recommendationDTO.get(1);
List<Product> resultProductList = new ArrayList<>();
if (secondFavorRecommendationDTO.getAnswer().split(", ").length > 1) {
return productList.stream()
.filter(
product ->
product.getCharacteristic()
.contains(
secondFavorRecommendationDTO.getAnswer()
.split(", ")[0]))
.filter(
product ->
product.getCharacteristic()
.contains(
secondFavorRecommendationDTO.getAnswer()
.split(", ")[1]))
.toList();
} else {
return productList.stream()
.filter(
product ->
product.getCharacteristic()
.contains(secondFavorRecommendationDTO.getAnswer()))
.toList();
}
// FavorRecommendationDTO secondFavorRecommendationDTO = recommendationDTO.get(1);
// List<Product> resultProductList = new ArrayList<>();
// if (secondFavorRecommendationDTO.getAnswer().split(", ").length > 1) {
// return productList.stream()
// .filter(
// product ->
// product.getCharacteristic()
// .contains(
//
// secondFavorRecommendationDTO.getAnswer()
// .split(", ")[0]))
// .filter(
// product ->
// product.getCharacteristic()
// .contains(
//
// secondFavorRecommendationDTO.getAnswer()
// .split(", ")[1]))
// .toList();
// } else {
// return productList.stream()
// .filter(
// product ->
// product.getCharacteristic()
//
// .contains(secondFavorRecommendationDTO.getAnswer()))
// .toList();
// }
}

@Override
Expand Down

0 comments on commit 8a7a74a

Please sign in to comment.