diff --git a/mens-api/src/main/java/kr/xit/ens/support/nice/service/NiceCiDummyTestService.java b/mens-api/src/main/java/kr/xit/ens/support/nice/service/NiceCiDummyTestService.java index 13ea22e..9f036dc 100644 --- a/mens-api/src/main/java/kr/xit/ens/support/nice/service/NiceCiDummyTestService.java +++ b/mens-api/src/main/java/kr/xit/ens/support/nice/service/NiceCiDummyTestService.java @@ -90,13 +90,13 @@ public class NiceCiDummyTestService extends EgovAbstractServiceImpl { return TokenResponse.builder() .dataHeader(ResponseDataHeader.builder() - .gw_rslt_cd("1200") - .gw_rslt_cd("오류없음") + .gwRsltCd("1200") + .gwRsltMsg("오류없음") .build()) .dataBody(TokenResDataBody.builder() - .access_token("ff5e27fe-8b5d-49db-ab1e-0ccf07de6ac1") - .token_type("bearer") - .expires_in(1.57698305E9) + .accessToken("ff5e27fe-8b5d-49db-ab1e-0ccf07de6ac1") + .tokenType("bearer") + .expiresIn(1.57698305E9) .scope("default") .build()) .build(); @@ -136,19 +136,19 @@ public class NiceCiDummyTestService extends EgovAbstractServiceImpl { return PublickeyResponse.builder() .dataHeader(ResponseDataHeader.builder() - .gw_rslt_cd("1200") - .gw_rslt_msg("오류없음") - .tran_id(reqDTO.getDataHeader().getTran_id()) - .cnty_id(reqDTO.getDataHeader().getCnty_id()) + .gwRsltCd("1200") + .gwRsltMsg("오류없음") + .tranId(reqDTO.getDataHeader().getTranId()) + .cntyId(reqDTO.getDataHeader().getCntyId()) .build()) .dataBody(PublickeyResDataBody.builder() - .rsp_cd("P000") - .rsp_msg("") - .result_cd("000") - .site_code("AAAA==") - .key_version("20210121ca8c1612-2c2d-IPaa-aad1-xxxxxxxxxxxx") - .public_key("MIIBIjANBgkqhkiG9w0BAQEFAA.....JJxwIDAQAB...") - .valid_dtim("20220121181550") + .rspCd("P000") + .rspMsg("") + .resultCd("000") + .siteCode("AAAA==") + .keyVersion("20210121ca8c1612-2c2d-IPaa-aad1-xxxxxxxxxxxx") + .publicKey("MIIBIjANBgkqhkiG9w0BAQEFAA.....JJxwIDAQAB...") + .validDtim("20220121181550") .build()) .build(); } diff --git a/mens-core/README.md b/mens-core/README.md index 2127990..eba0d5e 100644 --- a/mens-core/README.md +++ b/mens-core/README.md @@ -89,3 +89,55 @@ ex) app: # 필요시 xit-init 모듈 AppInitHelper.init() method 재정의 ``` +@ Class Property 대소문자 +Swagger API 사용시 대문자 필드 사용 불가 +대문자 필드 사용시 @Schema 속성 및 데이타 전달 불가 +@JsonProperty 또는 전체 클래스 필드인 경우 @JsonNaming 사용 +json <-> java class 변환 적용 가능 +```text + @JsonNaming(value = PropertyNamingStrategies.UpperSnakeCaseStrategy.class) + public static class RequestDataHeader { + + /** + *
+ * TRAN_ID : 요청한값 그대로 return + * 고유번호 : 최대 24 + *+ */ + @Schema(requiredMode = RequiredMode.AUTO, title = "TRAN_ID", example = "20230906120000") + @Size(min = 0, max = 24, message = "TRAN_ID는 24자를 넘을 수 없습니다.") + //@JsonProperty("TRAN_ID") + private String tran_id; + + /** + * CNTY_ID : 요청한값 그대로 return + */ + @Schema(requiredMode = RequiredMode.AUTO, title = "CNTY_ID", example = "kr") + @Size(min = 0, max = 2, message = "CNTY_ID는 2자를 넘을 수 없습니다.") + //@JsonProperty("CNTY_ID") + private String cnty_id; + } + /* + { + "TRAN_ID": "20230906120000", + "CNTY_ID": "kr" + } + -> getTranId, getCntyId + */ + + @JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) + public static class PublickeyReqDataBody { + /** + * 공개키 요청일시 (YYYYMMDDHH24MISS) + */ + @Schema(requiredMode = RequiredMode.REQUIRED, title = "공개키 요청일시", example = "2023090612122259") + @Size(min = 16, max = 16, message = "요청일시(req_dtim)는 필수 입니다(16자리)") + private String reqDtim; + } + /* + { + "req_dtim": "20230906120000", + } + -> getReqDtim + */ +``` diff --git a/mens-core/src/main/java/kr/xit/biz/ens/model/nice/NiceCiDTO.java b/mens-core/src/main/java/kr/xit/biz/ens/model/nice/NiceCiDTO.java index a343d82..a839049 100644 --- a/mens-core/src/main/java/kr/xit/biz/ens/model/nice/NiceCiDTO.java +++ b/mens-core/src/main/java/kr/xit/biz/ens/model/nice/NiceCiDTO.java @@ -2,6 +2,7 @@ package kr.xit.biz.ens.model.nice; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; import com.fasterxml.jackson.databind.PropertyNamingStrategy; import com.fasterxml.jackson.databind.annotation.JsonNaming; import io.swagger.v3.oas.annotations.media.Schema; @@ -43,6 +44,7 @@ public class NiceCiDTO { /** *
* 기관용 Token(50년 유효) 발급 요청 + * Json data : SNAKE_CASE (grant_type <-> grantType) **/ @Schema(name = "TokenRequest", description = "기관용 Token(50년 유효) 발급 요청 파라메터 DTO") @@ -51,6 +53,7 @@ public class NiceCiDTO { @AllArgsConstructor @Builder @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) public static class TokenRequest { /** * default 로 고정 @@ -66,7 +69,7 @@ public class NiceCiDTO { @Default @Schema(requiredMode = RequiredMode.REQUIRED, title = "grant_type", example = "clinet_credentials") @Size(min = 1, message = "grant_type은 필수입니다") - private String grant_type = "clinet_credentials"; + private String grantType = "clinet_credentials"; } /** @@ -111,7 +114,10 @@ public class NiceCiDTO { } /** + *
* 기관용 토큰 발급 응답 dataBody + * Json data : SNAKE_CASE (access_token <-> accessToken) + **/ @Schema(name = "TokenResDataBody", description = "기관용 토큰 발급 요청 응답 dataBody DTO") @Data @@ -119,6 +125,7 @@ public class NiceCiDTO { @AllArgsConstructor @SuperBuilder @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) public static class TokenResDataBody { //----------------------------------------------------------------------- // 토근 발급 요청시 필수값 @@ -130,20 +137,20 @@ public class NiceCiDTO { * */ @Schema(requiredMode = RequiredMode.AUTO, title = "사용자 엑세스 토큰 값", example = " ") - private String access_token; + private String accessToken; /** * token_type : token 발급시 필수 * bearer로 고정 */ @Schema(requiredMode = RequiredMode.AUTO, title = "token_type", example = "bearer") - private String token_type; + private String tokenType; /** * access 토큰 만료 시간(초) : token 발급시 필수 */ @Schema(requiredMode = RequiredMode.AUTO, title = "access 토큰 만료 시간(초)", example = "1.57698305E9") - private double expires_in; + private double expiresIn; /** *
@@ -215,7 +222,10 @@ public class NiceCiDTO { } /** - * Request dataHeader + *+ * 공개키 요청 dataBody DTO + * Json data : SNAKE_CASE (req_dtim <-> reqDtim) + **/ @Schema(name = "PublickeyReqDataBody", description = "공개키 요청 dataBody DTO") @Data @@ -223,27 +233,35 @@ public class NiceCiDTO { @AllArgsConstructor @SuperBuilder @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) public static class PublickeyReqDataBody { /** * 공개키 요청일시 (YYYYMMDDHH24MISS) */ @Schema(requiredMode = RequiredMode.REQUIRED, title = "공개키 요청일시", example = "2023090612122259") @Size(min = 16, max = 16, message = "요청일시(req_dtim)는 필수 입니다(16자리)") - private String req_dtim; + private String reqDtim; } + /** + *+ * 공개키 요청 응답 dataBody DTO + * Json data : SNAKE_CASE (rsp_cd <-> rspCd) + *+ */ @Schema(name = "PublickeyResDataBody", description = "공개키 요청 응답 dataBody DTO") @Data @NoArgsConstructor @AllArgsConstructor @SuperBuilder @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) public static class PublickeyResDataBody { /** * dataBody 정상처리여부 (P000 성공, 이외 모두 오류) : 8자리 */ @Schema(requiredMode = RequiredMode.REQUIRED, title = "정상처리 여부", example = "P000") - private String rsp_cd; + private String rspCd; /** *@@ -252,7 +270,7 @@ public class NiceCiDTO { **/ @Schema(requiredMode = RequiredMode.REQUIRED, title = "상세 메세지", example = " ") - private String rsp_msg; + private String rspMsg; /** *@@ -264,7 +282,7 @@ public class NiceCiDTO { **/ @Schema(requiredMode = RequiredMode.AUTO, title = "상세 결과코드", example = "0000") - private String result_cd; + private String resultCd; /** *@@ -272,7 +290,7 @@ public class NiceCiDTO { **/ @Schema(requiredMode = RequiredMode.AUTO, title = "사이트 코드", example = " ") - private String site_code; + private String siteCode; /** *@@ -280,7 +298,7 @@ public class NiceCiDTO { **/ @Schema(requiredMode = RequiredMode.AUTO, title = "공개키 버전", example = " ") - private String key_version; + private String keyVersion; /** *@@ -288,7 +306,7 @@ public class NiceCiDTO { **/ @Schema(requiredMode = RequiredMode.AUTO, title = "공개키", example = " ") - private String public_key; + private String publicKey; /** *@@ -296,7 +314,7 @@ public class NiceCiDTO { **/ @Schema(requiredMode = RequiredMode.AUTO, title = "공개키 만료일시", example = " ") - private String valid_dtim; + private String validDtim; } //-------------------------------------------------------------------------------- // 공개키 : publickey @@ -314,7 +332,10 @@ public class NiceCiDTO { //-------------------------------------------------------------------------------- /** + ** Request dataHeader + * Json data : UPPER_SNAKE_CASE (GW_RSLT_CD <-> gwRsltCd) + **/ @Schema(name = "RequestDataHeader", description = "Nice CI request dataHeader(공통)") @Data @@ -322,6 +343,7 @@ public class NiceCiDTO { @AllArgsConstructor @SuperBuilder @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonNaming(PropertyNamingStrategies.UpperSnakeCaseStrategy.class) public static class RequestDataHeader { /** @@ -332,21 +354,22 @@ public class NiceCiDTO { */ @Schema(requiredMode = RequiredMode.AUTO, title = "TRAN_ID", example = "20230906120000") @Size(min = 0, max = 24, message = "TRAN_ID는 24자를 넘을 수 없습니다.") - @JsonProperty("TRAN_ID") - private String tran_id; + private String tranId; /** * CNTY_ID : 요청한값 그대로 return */ @Schema(requiredMode = RequiredMode.AUTO, title = "CNTY_ID", example = "kr") @Size(min = 0, max = 2, message = "CNTY_ID는 2자를 넘을 수 없습니다.") - @JsonProperty("CNTY_ID") - private String cnty_id; + private String cntyId; } /** + ** Response dataHeader + * Json data : UPPER_SNAKE_CASE (GW_RSLT_CD <-> gwRsltCd) + **/ @Schema(name = "ResponseDataHeader", description = "Nice CI Response dataHeader(공통)") @Data @@ -354,6 +377,7 @@ public class NiceCiDTO { @AllArgsConstructor @SuperBuilder @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonNaming(PropertyNamingStrategies.UpperSnakeCaseStrategy.class) public static class ResponseDataHeader { /** *@@ -363,16 +387,14 @@ public class NiceCiDTO { */ @Schema(requiredMode = RequiredMode.REQUIRED, title = "응답코드", example = "1200") @Size(min = 1, max = 8) - @JsonProperty("GW_RSLT_CD") - private String gw_rslt_cd; + private String gwRsltCd; /** * 응답메세지 : 200 */ @Schema(requiredMode = RequiredMode.REQUIRED, title = "응답메세지", example = "오류없음") @Size(min = 1, max = 200) - @JsonProperty("GW_RSLT_MSG") - private String gw_rslt_msg; + private String gwRsltMsg; /** *@@ -381,8 +403,7 @@ public class NiceCiDTO { **/ @Schema(requiredMode = RequiredMode.AUTO, title = "TRAN_ID", example = " ") - @JsonProperty("TRAN_ID") - private String tran_id; + private String tranId; /** *@@ -391,8 +412,7 @@ public class NiceCiDTO { **/ @Schema(requiredMode = RequiredMode.AUTO, title = "CNTY_ID", example = " ") - @JsonProperty("CNTY_ID") - private String cnty_id; + private String cntyId; }