Skip to content

Commit

Permalink
[What 135] feat : 청구, 청구 리스트 조회 (#77)
Browse files Browse the repository at this point in the history
* 개인별 출공결 확인

* fix:checkedlistbyuser findby 네이밍수정

* feat :출석 종료시 유저별 출성 상황 반영

* feat: 청구 리스트 조회
  • Loading branch information
dPwls0125 committed Sep 24, 2023
1 parent 0d45bfd commit f766c87
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ public ResponseEntity<?> claim(@RequestBody AccountClaimDto dto) throws Exceptio
return accountService.createClaim(dto);
}

@Operation(
summary = "정산 청구 리스트 api",
description = "클럽에 소속된 모든 user에게 청구 신청"
)
public ResponseEntity<?> claimList() throws Exception {
log.info("정산 청구 리스트 api 호출");
Long clubId = 1L;
return accountService.getClaimList(clubId);
}

@Override
@Operation(
summary = "입출금 내역 입력 api",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ public interface AccountingController {
@PostMapping("/claim")
ResponseEntity<?> claim(@RequestBody AccountClaimDto dto) throws Exception;

@GetMapping("/claim/list")
ResponseEntity<?> claimList() throws Exception;

//입출금 내역 입력
@PostMapping("/book/create")
ResponseEntity createBook(@RequestBody AccountBookCreateDto accountBookCreateDto) throws Exception;
Expand All @@ -32,4 +35,5 @@ public interface AccountingController {
@DeleteMapping("/book/{bookId}")
ResponseEntity deleteBook(@PathVariable Long bookId) throws Exception;


}
5 changes: 4 additions & 1 deletion src/main/java/gdg/whatssue/repository/ClaimRepository.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package gdg.whatssue.repository;

import gdg.whatssue.entity.Claim;
import gdg.whatssue.entity.Club;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface ClaimRepository extends JpaRepository<Claim,Long> {

List<Claim> findAllByClub(Club club);
}
8 changes: 8 additions & 0 deletions src/main/java/gdg/whatssue/service/AccountService.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ public ResponseEntity<?> createClaim(AccountClaimDto dto) throws Exception {
return ResponseEntity.ok("정산 청구 완료");
}

public ResponseEntity<?> getClaimList(Long ClubId) {
Club club = clubRepository.findById(ClubId).orElseThrow(() -> (
new ResponseStatusException(HttpStatus.NOT_FOUND, "클럽을 찾을 수 없습니다.")
));
List<Claim> claimList = claimRepository.findAllByClub(club);
return ResponseEntity.ok(claimList);
}


@Transactional
//변경 (삭제, 입력) 이 일어날때마다 clubId에 해당하는 모든 TotalPaidAmount 가 같은 값을 가져야하는데 그게 안됨 (어려움)
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/gdg/whatssue/service/dto/AccountClaimDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@
@Schema(description = "정산 청구 DTO")
public class AccountClaimDto {
@Schema(description = "청구 이름", example = "엠티 비용 정산")
private String ClaimName;
private String claimName;
@Schema(description = "청구 내역", example = "18500.0")
private String ClaimAmount;
private String claimAmount;
@Schema(description = "청구 날짜", example = "2023-10-21")
private String ClaimDate;
private String claimDate;

@Builder
public AccountClaimDto(String ClaimName, String ClaimAmount, String ClaimDate) {
this.ClaimName = ClaimName;
this.ClaimAmount = ClaimAmount;
this.ClaimDate = ClaimDate;
public AccountClaimDto(String claimName, String claimAmount, String claimDate) {
this.claimName = claimName;
this.claimAmount = claimAmount;
this.claimDate = claimDate;
}
}

0 comments on commit f766c87

Please sign in to comment.