From 951e067d4ed643cc6abf1520722e871981297eb2 Mon Sep 17 00:00:00 2001 From: yunji118 Date: Thu, 11 Jan 2024 20:16:40 +0900 Subject: [PATCH] =?UTF-8?q?[feat]=20=ED=8C=90=EB=A7=A4=20=EB=93=B1?= =?UTF-8?q?=EB=A1=9D=ED=8F=BC=20=EC=83=81=EC=84=B8=EB=B3=B4=EA=B8=B0=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20=EC=A7=88=EB=AC=B8=20#160?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MySalesProject/dto/AdditionalQuestionDto.java | 15 +++++++++++++++ .../dto/MySalesDetailResponseDto.java | 4 +++- .../service/MySalesProjectService.java | 11 ++++++----- 3 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 src/main/java/wowmarket/wow_server/mypage/myproject/MySalesProject/dto/AdditionalQuestionDto.java diff --git a/src/main/java/wowmarket/wow_server/mypage/myproject/MySalesProject/dto/AdditionalQuestionDto.java b/src/main/java/wowmarket/wow_server/mypage/myproject/MySalesProject/dto/AdditionalQuestionDto.java new file mode 100644 index 0000000..950aaf6 --- /dev/null +++ b/src/main/java/wowmarket/wow_server/mypage/myproject/MySalesProject/dto/AdditionalQuestionDto.java @@ -0,0 +1,15 @@ +package wowmarket.wow_server.mypage.myproject.MySalesProject.dto; + +import lombok.Getter; +import wowmarket.wow_server.domain.OrderQuestion; + +@Getter +public class AdditionalQuestionDto { + private String question; + private boolean essential; + + public AdditionalQuestionDto(OrderQuestion orderQuestion){ + this.question = orderQuestion.getQuestion(); + this.essential = orderQuestion.isEssential(); + } +} diff --git a/src/main/java/wowmarket/wow_server/mypage/myproject/MySalesProject/dto/MySalesDetailResponseDto.java b/src/main/java/wowmarket/wow_server/mypage/myproject/MySalesProject/dto/MySalesDetailResponseDto.java index 92503fe..b58df18 100644 --- a/src/main/java/wowmarket/wow_server/mypage/myproject/MySalesProject/dto/MySalesDetailResponseDto.java +++ b/src/main/java/wowmarket/wow_server/mypage/myproject/MySalesProject/dto/MySalesDetailResponseDto.java @@ -32,9 +32,10 @@ public class MySalesDetailResponseDto { private String sellerPhoneNumber; private String sellerEmail; private String sellerEtc; + private List orderQuestionList; - public MySalesDetailResponseDto(Project project, List itemDtos){ + public MySalesDetailResponseDto(Project project, List itemDtos, List orderQuestionList){ this.projectId = project.getId(); this.projectName = project.getProjectName(); this.description = project.getDescription(); @@ -56,5 +57,6 @@ public MySalesDetailResponseDto(Project project, List itemDtos){ this.sellerPhoneNumber = project.getPhoneNumber(); this.sellerEmail = project.getEmail(); this.sellerEtc = project.getSellerEtc(); + this.orderQuestionList = orderQuestionList; } } diff --git a/src/main/java/wowmarket/wow_server/mypage/myproject/MySalesProject/service/MySalesProjectService.java b/src/main/java/wowmarket/wow_server/mypage/myproject/MySalesProject/service/MySalesProjectService.java index d2b0156..893ceeb 100644 --- a/src/main/java/wowmarket/wow_server/mypage/myproject/MySalesProject/service/MySalesProjectService.java +++ b/src/main/java/wowmarket/wow_server/mypage/myproject/MySalesProject/service/MySalesProjectService.java @@ -9,10 +9,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.server.ResponseStatusException; -import wowmarket.wow_server.domain.Category; -import wowmarket.wow_server.domain.Item; -import wowmarket.wow_server.domain.Project; -import wowmarket.wow_server.domain.User; +import wowmarket.wow_server.domain.*; import wowmarket.wow_server.global.jwt.SecurityUtil; import wowmarket.wow_server.mypage.myproject.MySalesProject.dto.*; import wowmarket.wow_server.repository.*; @@ -26,6 +23,7 @@ public class MySalesProjectService { private final ProjectRepository projectRepository; private final ItemRepository itemRepository; private final CategoryRepository categoryRepository; + private final OrderQuestionRepository orderQuestionRepository; @Transactional(readOnly = true) public MySalesListResponseDto findAllMySalesForm(Pageable pageable, User user){ @@ -59,7 +57,10 @@ public MySalesDetailResponseDto findMySalesDetail(Long project_id, User user){ List itemList = itemRepository.findByProject_Id(project_id); List itemDtos = itemList.stream().map(MySalesItemDto::new).collect(Collectors.toList()); - MySalesDetailResponseDto responseDto = new MySalesDetailResponseDto(project, itemDtos); + List orderQuestionList = orderQuestionRepository.findByProject_Id(project_id).stream().toList(); + List additionalQuestionDtos = orderQuestionList.stream().map(AdditionalQuestionDto::new).collect(Collectors.toList()); + + MySalesDetailResponseDto responseDto = new MySalesDetailResponseDto(project, itemDtos, additionalQuestionDtos); return responseDto; }