Skip to content

Commit

Permalink
feat : 정산 상제조회 api response에 생성일 정보 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
seongjunnoh committed Aug 18, 2024
1 parent 9080b49 commit 74e46c4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,6 @@ public class TotalPayInfoDto {

private boolean isComplete;

private String createdAt; // 정산 생성일 정보를 yyyy년 mm월 dd일 형식으로 변화한 문자열

}
16 changes: 11 additions & 5 deletions src/main/java/space/space_spring/service/PayService.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import space.space_spring.util.space.SpaceUtils;
import space.space_spring.util.user.UserUtils;

import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
Expand Down Expand Up @@ -158,20 +159,24 @@ public TotalPayInfoDto getTotalPayInfo(Long spaceId, Long payRequestId) {
// TODO 2. payRequestId 로 PayRequest 엔티티 find
PayRequest payRequestById = payDao.findPayRequestById(payRequestId);

// TODO 3. PayRequest로 해당 정산의 정보 get
// TODO 3. PayRequest의 생성일 형식 'yyyy년 mm월 dd일' 로 변경
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy년 MM월 dd일");
String payCreatedDate = payRequestById.getCreatedAt().format(formatter);

// TODO 4. PayRequest로 해당 정산의 정보 get
PayRequestInfoDto payRequestInfoDto = createPayRequestInfoDto(payRequestById);

// TODO 4. PayRequest의 PayRequestTarget find
// TODO 5. PayRequest의 PayRequestTarget find
List<PayRequestTarget> payRequestTargetListByPayRequest = payDao.findPayRequestTargetListByPayRequest(payRequestById);

// TODO 5. 정산 타겟 유저 정보 get
// TODO 6. 정산 타겟 유저 정보 get
List<PayTargetInfoDto> payTargetInfoDtoList = new ArrayList<>();
for (PayRequestTarget payRequestTarget : payRequestTargetListByPayRequest) {
PayTargetInfoDto payTargetInfoDto = createPayTargetInfoDto(payRequestTarget, spaceBySpaceId);
payTargetInfoDtoList.add(payTargetInfoDto);
}

// TODO 6. return 타입 구성
// TODO 7. return 타입 구성
return new TotalPayInfoDto(
payRequestId,
payRequestById.getBankName(),
Expand All @@ -181,7 +186,8 @@ public TotalPayInfoDto getTotalPayInfo(Long spaceId, Long payRequestId) {
payRequestInfoDto.getTotalTargetNum(),
payRequestInfoDto.getReceiveTargetNum(),
payTargetInfoDtoList,
payRequestById.isComplete()
payRequestById.isComplete(),
payCreatedDate
);
}

Expand Down

0 comments on commit 74e46c4

Please sign in to comment.