Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

대관장 오류 새결 #162

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/main/java/umc/ShowHoo/web/shows/dto/ShowsResponseDTO.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,13 @@ public static class ShowDateDTO{
String dDay;
}

@Builder
@Getter
@NoArgsConstructor
@AllArgsConstructor
public static class ShowTitleAndPosterDTO{
String poster;
String title;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import org.springframework.data.jpa.repository.JpaRepository;
import umc.ShowHoo.web.spaceAdditionalService.entity.SpaceAdditionalService;
import umc.ShowHoo.web.spaceApply.service.SpaceApplyService;

public interface SpaceAdditionalServiceRepository extends JpaRepository<SpaceAdditionalService, Long> {
SpaceAdditionalService findBySpaceIdAndTitle(Long spaceId, String title);

}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
public class SpaceApplyController {
private final SpaceApplyService spaceApplyService;

@Operation(summary = "대관 신청 API", description = "공연자 유저가 대관 신청을 클릭했을 때 대관 신청 내역을 저장하는 API입니다. 이때 rentalFee는 날짜에 따른 가격, rentalSum은 날짜가격 + 추가서비스 가격입니다. selectedAdditionalServices는 대관신청하면서 선택한 추가 서비스의 id값 넘겨주시면 돼요")
@Operation(summary = "대관 신청 API", description = "공연자 유저가 대관 신청을 클릭했을 때 대관 신청 내역을 저장하는 API입니다. 이때 rentalFee는 날짜에 따른 가격, rentalSum은 날짜가격 + 추가서비스 가격입니다. selectedAdditionalServices는 대관신청하면서 SpaceAdditionalServiceId 넘겨주시면 되요.")
@ApiResponses({
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "OK, 성공"),
})
Expand Down Expand Up @@ -99,6 +99,7 @@ public ApiResponse<List<SpaceApplyResponseDTO.SpaceApplyWitProfilesDTO>> getSpac
}



@Operation(summary = "대관 영수증 확인 API", description = "공연장이 대관 수락 후 영수증을 확인하는 API 관련 additionalService가 보여야 합.")
@ApiResponses({
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "ok, 성공"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import umc.ShowHoo.web.performerProfile.entity.PerformerProfile;
import umc.ShowHoo.web.selectedAdditionalService.dto.SelectedAdditionalDTO;
import umc.ShowHoo.web.selectedAdditionalService.entity.SelectedAdditionalService;
import umc.ShowHoo.web.shows.dto.ShowsResponseDTO;
import umc.ShowHoo.web.spacePhoto.entity.SpacePhoto;


Expand Down Expand Up @@ -41,8 +42,7 @@ public static class SpaceApplyWitProfilesDTO {
private Integer rentalSum;
private String spaceName;
private String spaceLocation;
private String title; //공연 제목
private String poster; //공연 포스터
private List<ShowsResponseDTO.ShowTitleAndPosterDTO> shows;
}

@Builder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@
import umc.ShowHoo.web.selectedAdditionalService.dto.SelectedAdditionalDTO;
import umc.ShowHoo.web.selectedAdditionalService.entity.SelectedAdditionalService;
import umc.ShowHoo.web.selectedAdditionalService.repository.SelectedAdditionalServiceRepository;
import umc.ShowHoo.web.shows.dto.ShowsResponseDTO;
import umc.ShowHoo.web.shows.entity.Shows;
import umc.ShowHoo.web.shows.repository.ShowsRepository;
import umc.ShowHoo.web.space.entity.Space;
import umc.ShowHoo.web.space.exception.handler.SpaceHandler;
import umc.ShowHoo.web.space.repository.SpaceRepository;
import umc.ShowHoo.web.spaceAdditionalService.entity.SpaceAdditionalService;
import umc.ShowHoo.web.spaceAdditionalService.repository.SpaceAdditionalServiceRepository;
import umc.ShowHoo.web.spaceApply.converter.SpaceApplyConverter;
import umc.ShowHoo.web.spaceApply.dto.SpaceApplyRequestDTO;
import umc.ShowHoo.web.spaceApply.dto.SpaceApplyResponseDTO;
Expand All @@ -47,6 +50,7 @@ public class SpaceApplyService {
private final SpaceApplyConverter spaceApplyConverter;
private final NotificationService notificationService;
private final HolidayRepository holidayRepository;
private final SpaceAdditionalServiceRepository spaceAdditionalServiceRepository;

private final PerformerProfileRepository performerProfileRepository;
private final ShowsRepository showsRepository;
Expand All @@ -65,8 +69,15 @@ public SpaceApply createSpaceApply(Long spaceId, Long performerId, SpaceApplyReq
spaceApplyRepository.save(spaceApply);

for (Long serviceId : registerDTO.getSelectedAdditionalServices()) {
SpaceAdditionalService spaceAdditionalService = spaceAdditionalServiceRepository.findById(serviceId)
.orElseThrow(() -> new SpaceHandler(ErrorStatus._BAD_REQUEST));
System.out.println("spaceAdditionalService = " + spaceAdditionalService);



SelectedAdditionalService additionalService = SelectedAdditionalService.builder()
.serviceId(serviceId)
.spaceAdditionalService(spaceAdditionalService)
.spaceApply(spaceApply)
.build();
selectedAdditionalServiceRepository.save(additionalService);
Expand Down Expand Up @@ -145,24 +156,32 @@ public List<SpaceApplyResponseDTO.SpaceApplyWitProfilesDTO> getSpaceAppliesBySpa
List<Shows> showsList = showsRepository.findBySpaceApply(spaceApply);
System.out.println("Shows List for SpaceApply ID " + spaceApply.getId() + ": " + showsList);


List<ShowsResponseDTO.ShowTitleAndPosterDTO> showDTOList = new ArrayList<>();
for (Shows show : showsList) {
SpaceApplyResponseDTO.SpaceApplyWitProfilesDTO dto = SpaceApplyResponseDTO.SpaceApplyWitProfilesDTO.builder()
.id(spaceApply.getId())
.date(spaceApply.getDate())
.status(spaceApply.getStatus())
.audienceMin(spaceApply.getAudienceMin())
.audienceMax(spaceApply.getAudienceMax())
.rentalSum(spaceApply.getRentalSum())
.spaceName(spaceApply.getSpace().getName())
.spaceLocation(spaceApply.getSpace().getLocation())
ShowsResponseDTO.ShowTitleAndPosterDTO showDTO = ShowsResponseDTO.ShowTitleAndPosterDTO.builder()
.title(show.getName())
.poster(show.getPoster())
.build();
showDTOList.add(showDTO);
}

// SpaceApplyWithShowsDTO 생성
SpaceApplyResponseDTO.SpaceApplyWitProfilesDTO dto = SpaceApplyResponseDTO.SpaceApplyWitProfilesDTO.builder()
.id(spaceApply.getId())
.date(spaceApply.getDate())
.status(spaceApply.getStatus())
.audienceMin(spaceApply.getAudienceMin())
.audienceMax(spaceApply.getAudienceMax())
.rentalSum(spaceApply.getRentalSum())
.spaceName(spaceApply.getSpace().getName())
.spaceLocation(spaceApply.getSpace().getLocation())
.shows(showDTOList) // Shows 목록 추가
.build();

dtoList.add(dto);

dtoList.add(dto);
}
}

System.out.println("Final DTO List: " + dtoList);

return dtoList;
Expand Down
Loading