Skip to content

Commit

Permalink
feat: 내 집 마련 공식 API
Browse files Browse the repository at this point in the history
  • Loading branch information
eojinny committed Dec 5, 2023
1 parent 3433c7d commit 6d8bb36
Show file tree
Hide file tree
Showing 20 changed files with 7 additions and 4 deletions.
Binary file modified .gradle/8.5/executionHistory/executionHistory.bin
Binary file not shown.
Binary file modified .gradle/8.5/executionHistory/executionHistory.lock
Binary file not shown.
Binary file modified .gradle/8.5/fileHashes/fileHashes.bin
Binary file not shown.
Binary file modified .gradle/8.5/fileHashes/fileHashes.lock
Binary file not shown.
Binary file modified .gradle/8.5/fileHashes/resourceHashesCache.bin
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified build/tmp/compileJava/previous-compilation-data.bin
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public BaseResponse<List<ApartmentDto.Response>> getProductList(){
return BaseResponse.onSuccess(apartmentList);
}
@GetMapping("/{apartment-Id}/{goal-Year}")
public BaseResponse<Long> getMyHomeResult(@PathVariable("apartment-Id") Long id , @PathVariable("goal-Year") int goalYear){
public BaseResponse<Double> getMyHomeResult(@PathVariable("apartment-Id") Long id , @PathVariable("goal-Year") int goalYear){
return BaseResponse.onSuccess(apartmentService.findByHome(id , goalYear));
}
//TODO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,14 @@ public List<ApartmentDto.Response> findByAll() {
.map(ApartmentDto.Response::new)
.collect(Collectors.toList());
}
public Long findByHome(Long id, int goalYear){
public static double calculateExpression(double a, double b, double n) {
return Math.pow(a / b, 1.0 / n) - 1;
}
public Double findByHome(Long id, int goalYear){
//(현재 집 시세 - 현재 자산) / (수익 - 필수 소비 금액)
Apartment apartment = apartmentRepository.findById(id).orElseThrow(() -> new IllegalArgumentException("해당 아파트가 존재하지 않습니다."));
long apartmentPrice = Long.parseLong(apartment.getPrice());
long result = (apartmentPrice - 200000000) / (400 - 80);
return result/goalYear;

return calculateExpression(apartmentPrice,15000000,goalYear) * 100;
}
}

0 comments on commit 6d8bb36

Please sign in to comment.