-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
256 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 53 additions & 17 deletions
70
src/main/java/com/gaseng/kyc/controller/KycManageApiController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,85 @@ | ||
package com.gaseng.kyc.controller; | ||
|
||
import java.util.List; | ||
|
||
import javax.validation.Valid; | ||
|
||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import com.gaseng.global.common.BaseResponse; | ||
import com.gaseng.kyc.dto.KycRequireResponse; | ||
import com.gaseng.kyc.dto.KycRequireSummaryResponse; | ||
import com.gaseng.kyc.dto.KycSaveRequest; | ||
import com.gaseng.kyc.service.KycManageService; | ||
|
||
import io.swagger.annotations.Api; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.Parameter; | ||
import io.swagger.v3.oas.annotations.parameters.RequestBody; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponses; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.security.access.prepost.PreAuthorize; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
import javax.validation.Valid; | ||
import java.util.List; | ||
|
||
@Api(tags = "Kyc Api") | ||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/kyc") | ||
public class KycManageApiController { | ||
private final KycManageService kycManageService; | ||
|
||
|
||
@PreAuthorize("hasRole('ADMIN')") | ||
@Operation(summary = "kyc μμ² μ‘°ν", description = "kyc μμ²μλ₯Ό μ‘°νν©λλ€.") | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "200", description = "μμ²μ μ±κ³΅νμ΅λλ€."), | ||
@ApiResponse(responseCode = "404", description = "KYC μμ²μ μ°Ύμ μ μμ΅λλ€."), | ||
@ApiResponse(responseCode = "500", description = "μλ²μμ μ°κ²°μ μ€ν¨νμ΅λλ€.") | ||
}) | ||
@GetMapping("") | ||
public BaseResponse<KycRequireResponse> get(@RequestParam Long kycrId) { | ||
public BaseResponse<KycRequireResponse> get( | ||
@Parameter(description = "kyc require id", required = true, example = "1") | ||
@RequestParam Long kycrId | ||
) { | ||
return new BaseResponse<>(kycManageService.get(kycrId)); | ||
} | ||
|
||
@Operation(summary = "kyc μμ² μ 체 μ‘°ν", description = "kyc μμ²μλ₯Ό μ‘°νν©λλ€.") | ||
|
||
@PreAuthorize("hasRole('ADMIN')") | ||
@Operation(summary = "kyc μμ² μ 체 μ‘°ν", description = "kyc μμ²μ λͺ©λ‘μ μ‘°νν©λλ€.") | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "200", description = "μμ²μ μ±κ³΅νμ΅λλ€."), | ||
@ApiResponse(responseCode = "500", description = "μλ²μμ μ°κ²°μ μ€ν¨νμ΅λλ€.") | ||
}) | ||
@GetMapping("/all") | ||
public BaseResponse<List<KycRequireSummaryResponse>> getAll() { | ||
return new BaseResponse<>(kycManageService.getAll()); | ||
} | ||
|
||
|
||
@PreAuthorize("hasRole('ADMIN')") | ||
@Operation(summary = "kyc μ μ₯", description = "kycλ₯Ό μ μ₯ν©λλ€.") | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "200", description = "μμ²μ μ±κ³΅νμ΅λλ€."), | ||
@ApiResponse(responseCode = "404", description = "KYC μμ²μ μ°Ύμ μ μμ΅λλ€. / λΉνμ±νλ KYC μμ²μ λλ€."), | ||
@ApiResponse(responseCode = "500", description = "μλ²μμ μ°κ²°μ μ€ν¨νμ΅λλ€.") | ||
}) | ||
@PostMapping("") | ||
public BaseResponse<Long> save(@RequestParam Long kycrId, @RequestBody @Valid KycSaveRequest request) throws Exception { | ||
public BaseResponse<Long> save( | ||
@Parameter(description = "kyc require id", required = true, example = "1") | ||
@RequestParam Long kycrId, | ||
@RequestBody @Valid KycSaveRequest request | ||
) throws Exception { | ||
return new BaseResponse<>(kycManageService.save(kycrId, request)); | ||
} | ||
|
||
@PreAuthorize("hasRole('ADMIN')") | ||
@Operation(summary = "λ²μ£ μ΄λ ₯ μ‘°ν", description = "kyc μΈμ¦μ μμ²ν μ¬μ©μμ λ²μ£ μ΄λ ₯μ μ‘°νν©λλ€.") | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "200", description = "μμ²μ μ±κ³΅νμ΅λλ€."), | ||
@ApiResponse(responseCode = "404", description = "KYC μμ²μ μ°Ύμ μ μμ΅λλ€. / μΌμΉνλ νμμ΄ μμ΅λλ€."), | ||
@ApiResponse(responseCode = "500", description = "μλ²μμ μ°κ²°μ μ€ν¨νμ΅λλ€.") | ||
}) | ||
@GetMapping("/criminal-records/{kycrId}") | ||
public BaseResponse<String> getCriminalRecord( | ||
@Parameter(description = "kyc require id", required = true, example = "1") | ||
@PathVariable Long kycrId | ||
) { | ||
return new BaseResponse<>(kycManageService.getCriminalRecord(kycrId)); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.gaseng.kyc.domain; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import javax.persistence.*; | ||
|
||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@Entity | ||
@Table(name = "criminal_record") | ||
public class CriminalRecord { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long cmrId; | ||
|
||
private String cmrName; | ||
|
||
private String cmrPhone; | ||
|
||
private String cmrContent; | ||
} |
10 changes: 8 additions & 2 deletions
10
src/main/java/com/gaseng/kyc/dto/KycRequireSummaryResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
src/main/java/com/gaseng/kyc/repository/CriminalRecordRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.gaseng.kyc.repository; | ||
|
||
import com.gaseng.kyc.domain.CriminalRecord; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface CriminalRecordRepository extends JpaRepository<CriminalRecord, Long> { | ||
boolean existsByCmrNameAndCmrPhone(String name, String phone); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.