Skip to content

Commit

Permalink
spotless apply
Browse files Browse the repository at this point in the history
  • Loading branch information
bongsh0112 committed Dec 26, 2023
1 parent 0afd474 commit 1fdbee2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,12 @@ public List<ProductRetrieveDTO> findAllBySmallCategory(
@Override
public List<Product> searchAllByCategoryName(String categoryName) {
return queryFactory
.selectFrom(product)
.innerJoin(favorQuestionCategory)
.on(
favorQuestionCategory.id.eq(product.favorQuestionCategoryId),
favorQuestionCategory.name.eq(categoryName))
.fetch();
.selectFrom(product)
.innerJoin(favorQuestionCategory)
.on(
favorQuestionCategory.id.eq(product.favorQuestionCategoryId),
favorQuestionCategory.name.eq(categoryName))
.fetch();
}

private OrderSpecifier[] orderByPrice(PriceOrder priceOrder) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package tify.server.domain.domains.question.strategy;


import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
import lombok.RequiredArgsConstructor;
import org.springframework.transaction.annotation.Transactional;
import tify.server.domain.domains.product.adaptor.ProductAdaptor;
Expand All @@ -24,13 +22,13 @@ public class HEEXERecommendationStrategy implements ProductRecommendationStrateg
private static final String CATEGORY_NAME = "HEEXE";

@Override
public List<Product> recommendation(Long userId, String categoryName,
List<FavorRecommendationDTO> dto) {
public List<Product> recommendation(
Long userId, String categoryName, List<FavorRecommendationDTO> dto) {

List<FavorRecommendationDTO> recommendationDTO = getRecommendDTO(userId);

List<String> splitAnswer = Arrays.stream(recommendationDTO.get(0).getAnswer().split(", "))
.toList();
List<String> splitAnswer =
Arrays.stream(recommendationDTO.get(0).getAnswer().split(", ")).toList();

if (splitAnswer.contains("그 외")) {
return etcStep(splitAnswer);
Expand All @@ -42,7 +40,7 @@ public List<Product> recommendation(Long userId, String categoryName,
private List<FavorRecommendationDTO> getRecommendDTO(Long userId) {
List<FavorAnswer> favorAnswers = new ArrayList<>();
favorAnswers.add(
favorAnswerAdaptor.searchByCategoryNameAndNumber(userId, CATEGORY_NAME, 2L));
favorAnswerAdaptor.searchByCategoryNameAndNumber(userId, CATEGORY_NAME, 2L));
return favorAnswers.stream().map(FavorRecommendationDTO::from).toList();
}

Expand All @@ -58,13 +56,16 @@ private List<Product> etcStep(List<String> splitAnswer) { // 그 외 라는 답
private List<Product> specificStep(List<String> splitAnswer) { // 그 외 라는 답변 존재하지 않을 때
List<Product> result = new ArrayList<>();
if (splitAnswer.size() > 1) { // ex) 헬스, 요가&필라테스
result.addAll(productAdaptor.queryAllByCategoryNameAndCharacter(CATEGORY_NAME,
splitAnswer.get(0)));
result.addAll(productAdaptor.queryAllByCategoryNameAndCharacter(CATEGORY_NAME,
splitAnswer.get(1)));
result.addAll(
productAdaptor.queryAllByCategoryNameAndCharacter(
CATEGORY_NAME, splitAnswer.get(0)));
result.addAll(
productAdaptor.queryAllByCategoryNameAndCharacter(
CATEGORY_NAME, splitAnswer.get(1)));
} else { // ex) 헬스
result.addAll(productAdaptor.queryAllByCategoryNameAndCharacter(CATEGORY_NAME,
splitAnswer.get(0)));
result.addAll(
productAdaptor.queryAllByCategoryNameAndCharacter(
CATEGORY_NAME, splitAnswer.get(0)));
}
return result;
}
Expand Down

0 comments on commit 1fdbee2

Please sign in to comment.