From 1f803be6a883925990270eda371c27de121447ea Mon Sep 17 00:00:00 2001 From: ibaesuyeon Date: Tue, 5 Dec 2023 13:25:44 +0900 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20compensationClaim=20swagger?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CompensationClaimController.java | 112 ++++++++++++++++-- 1 file changed, 103 insertions(+), 9 deletions(-) diff --git a/src/main/java/aplus/insurancesystem/domain/compensationClaim/controller/CompensationClaimController.java b/src/main/java/aplus/insurancesystem/domain/compensationClaim/controller/CompensationClaimController.java index c50a0c2..964c600 100644 --- a/src/main/java/aplus/insurancesystem/domain/compensationClaim/controller/CompensationClaimController.java +++ b/src/main/java/aplus/insurancesystem/domain/compensationClaim/controller/CompensationClaimController.java @@ -1,6 +1,7 @@ package aplus.insurancesystem.domain.compensationClaim.controller; import aplus.insurancesystem.common.dto.SuccessResponse; +import aplus.insurancesystem.common.exception.ErrorCode; import aplus.insurancesystem.domain.compensationClaim.dto.request.CreateCarAccidentRequest; import aplus.insurancesystem.domain.compensationClaim.dto.request.CreateCompensationClaimRequest; import aplus.insurancesystem.domain.compensationClaim.dto.request.CreateSurveyRequest; @@ -9,6 +10,13 @@ import aplus.insurancesystem.domain.compensationClaim.dto.response.CompensationClaimResponse; import aplus.insurancesystem.domain.compensationClaim.dto.response.SurveyResponse; import aplus.insurancesystem.domain.compensationClaim.service.CompensationClaimService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; import lombok.RequiredArgsConstructor; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -22,6 +30,12 @@ public class CompensationClaimController { private final CompensationClaimService compensationClaimService; + @Operation(summary = "모든 청구 내역(리스트) 조회", description = "(관리자용) 모든 청구 내역(리스트) 조회 API") + @ApiResponses(value = { + @ApiResponse( + responseCode = "200", + description = "모든 청구 내역(리스트) 반환"), + }) @GetMapping("/all") public ResponseEntity>> getAllCompensationClaim() { return SuccessResponse.of( @@ -29,33 +43,85 @@ public ResponseEntity>> getAllCo ).asHttp(HttpStatus.OK); } + @Operation(summary = "고객별 청구 내역(리스트) 조회", description = "고객ID로 청구 내역(리스트) 조회 API") + @ApiResponses(value = { + @ApiResponse( + responseCode = "200", + description = "고객ID로 청구 내역(리스트) 반환"), + }) @GetMapping("/{id}") - public ResponseEntity>> getCompensationClaim(@PathVariable("id") Long customerId) { + public ResponseEntity>> getCompensationClaim( + @Parameter(description = "고객 id", in = ParameterIn.PATH) + @PathVariable("id") Long customerId) { return SuccessResponse.of( compensationClaimService.getCompensationClaim(customerId) ).asHttp(HttpStatus.OK); } - + @Operation(summary = "개별 청구 내역 상세 조회", description = "청구ID로 청구 내역 조회 API") + @ApiResponses(value = { + @ApiResponse( + responseCode = "200", + description = "청구ID로 청구 내역 반환"), + @ApiResponse( + responseCode = "404", + description = "CC001: id에 해당하는 청구 내역을 찾을 수 없습니다.", + content = @Content(schema = @Schema(hidden = true))) + }) @GetMapping("/detail/{ccid}") - public ResponseEntity> getCompensationClaimDetail(@PathVariable("ccid") Long CCID) { + public ResponseEntity> getCompensationClaimDetail( + @Parameter(description = "청구 id", in = ParameterIn.PATH) + @PathVariable("ccid") Long CCID) { return SuccessResponse.of( compensationClaimService.getCompensationClaimDetail(CCID) ).asHttp(HttpStatus.OK); } + @Operation(summary = "개별 사고 접수 내역 상세 조회", description = "청구ID로 사고 접수 내역 조회 API") + @ApiResponses(value = { + @ApiResponse( + responseCode = "200", + description = "청구ID로 사고 접수 내역 반환"), + @ApiResponse( + responseCode = "404", + description = "CA001: id에 해당하는 사고 접수 내역을 찾을 수 없습니다.", + content = @Content(schema = @Schema(hidden = true))) + }) @GetMapping("/detail/car/{ccid}") - public ResponseEntity> getCarAccidentDetail(@PathVariable("ccid") Long CCID) { + public ResponseEntity> getCarAccidentDetail( + @Parameter(description = "청구 id", in = ParameterIn.PATH) + @PathVariable("ccid") Long CCID) { return SuccessResponse.of( compensationClaimService.getCarAccidentDetail(CCID) ).asHttp(HttpStatus.OK); } + @Operation(summary = "보상금 청구", description = "보상금 청구 API") + @ApiResponses(value = { + @ApiResponse( + responseCode = "200", + description = "보상금 청구 완료"), + @ApiResponse( + responseCode = "404", + description = "I001: id에 해당하는 보험을 찾을 수 없습니다. \n" + + "U001: id에 해당하는 유저를 찾을 수 없습니다.", + content = @Content(schema = @Schema(hidden = true))) + }) @PostMapping("/claim") public ResponseEntity createCompensationClaim(@RequestBody CreateCompensationClaimRequest request) { compensationClaimService.createCompensationClaim(request); return ResponseEntity.status(HttpStatus.CREATED).build(); } - + @Operation(summary = "보상금 청구 및 사고 접수", description = "보상금 청구 및 사고 접수 API") + @ApiResponses(value = { + @ApiResponse( + responseCode = "200", + description = "보상금 청구 및 사고 접수 완료"), + @ApiResponse( + responseCode = "404", + description = "I001: id에 해당하는 보험을 찾을 수 없습니다. \n" + + "U001: id에 해당하는 유저를 찾을 수 없습니다.", + content = @Content(schema = @Schema(hidden = true))) + }) @PostMapping("/claim/car") public ResponseEntity createCarAccident(@RequestBody CreateCarAccidentRequest request) { compensationClaimService.createCarAccident(request); @@ -63,22 +129,50 @@ public ResponseEntity createCarAccident(@RequestBody CreateCarAccidentRequ } //손해사정 - + @Operation(summary = "손해사정 내역 상세 조회", description = "청구ID로 손해사정 내역 조회 API") + @ApiResponses(value = { + @ApiResponse( + responseCode = "200", + description = "청구ID로 손해사정 내역 반환"), + @ApiResponse( + responseCode = "404", + description = "S001: id에 해당하는 손해사정 내역을 찾을 수 없습니다.", + content = @Content(schema = @Schema(hidden = true))) + }) @GetMapping("/survey/{ccid}") - public ResponseEntity> getSurvey(@PathVariable("ccid") Long CCID) { + public ResponseEntity> getSurvey( + @Parameter(description = "청구 id", in = ParameterIn.PATH) + @PathVariable("ccid") Long CCID) { return SuccessResponse.of( compensationClaimService.getSurvey(CCID) ).asHttp(HttpStatus.OK); } - + @Operation(summary = "손해사정", description = "손해사정 생성 API") + @ApiResponses(value = { + @ApiResponse( + responseCode = "200", + description = "손해사정 완료"), + }) @PostMapping("/survey") public ResponseEntity createSurvey(@RequestBody CreateSurveyRequest request) { compensationClaimService.createSurvey(request); return ResponseEntity.status(HttpStatus.CREATED).build(); } + @Operation(summary = "손해사정 수정", description = "손해사정 수정 API") + @ApiResponses(value = { + @ApiResponse( + responseCode = "200", + description = "손해사정 내역 수정 완료"), + @ApiResponse( + responseCode = "404", + description = "S001: id에 해당하는 손해사정 내역을 찾을 수 없습니다.", + content = @Content(schema = @Schema(hidden = true))) + }) @PutMapping("/survey/{ccid}") - public ResponseEntity updateSurvey(@PathVariable("ccid") Long ccid, @RequestBody UpdateSurveyRequest request) { + public ResponseEntity updateSurvey( + @Parameter(description = "청구 id", in = ParameterIn.PATH) + @PathVariable("ccid") Long ccid, @RequestBody UpdateSurveyRequest request) { compensationClaimService.updateSurvey(ccid, request); return ResponseEntity.status(HttpStatus.OK).build(); } From 7a6f53ef2e01ff82ce4a7e730e72b9994c6668dd Mon Sep 17 00:00:00 2001 From: ibaesuyeon Date: Tue, 5 Dec 2023 13:33:02 +0900 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20swaggerConfig=20=EB=B3=B4=EC=83=81?= =?UTF-8?q?=EA=B8=88=EC=B2=AD=EA=B5=ACAPI=20=EA=B7=B8=EB=A3=B9=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../insurancesystem/common/config/SwaggerConfig.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/aplus/insurancesystem/common/config/SwaggerConfig.java b/src/main/java/aplus/insurancesystem/common/config/SwaggerConfig.java index c22badb..c246a25 100644 --- a/src/main/java/aplus/insurancesystem/common/config/SwaggerConfig.java +++ b/src/main/java/aplus/insurancesystem/common/config/SwaggerConfig.java @@ -84,4 +84,15 @@ public GroupedOpenApi paymentOpenApi() { .pathsToMatch(paths) .build(); } + + @Bean + public GroupedOpenApi compensationClaimOpenApi() { + String[] paths = {"/compensation-claim/**"}; + + return GroupedOpenApi + .builder() + .group("보상금 청구 API") + .pathsToMatch(paths) + .build(); + } }