diff --git a/mens-api/src/main/java/kr/xit/biz/kt/service/BizKtMmsService.java b/mens-api/src/main/java/kr/xit/biz/kt/service/BizKtMmsService.java index 4c8616e..0ffb18a 100644 --- a/mens-api/src/main/java/kr/xit/biz/kt/service/BizKtMmsService.java +++ b/mens-api/src/main/java/kr/xit/biz/kt/service/BizKtMmsService.java @@ -13,9 +13,13 @@ import kr.xit.biz.ens.model.kt.KtMmsSendDTO.KtMainSendRequest; import kr.xit.biz.ens.model.kt.KtMmsSendDTO.KtMsgRsltReqData; import kr.xit.biz.ens.model.kt.KtMmsSendDTO.KtMsgRsltRequest; import kr.xit.biz.ens.model.kt.KtTokenDTO; +import kr.xit.biz.ens.model.kt.KtTokenDTO.KtTokenConfirmResponse; +import kr.xit.biz.ens.model.kt.KtTokenDTO.KtTokenReadRequest; import kr.xit.biz.ens.model.kt.KtTokenDTO.KtTokenResponse; import kr.xit.biz.kt.mapper.IBizKtMmsMapper; +import kr.xit.core.consts.ErrorCode; import kr.xit.core.exception.BizRuntimeException; +import kr.xit.core.support.utils.Checks; import kr.xit.core.support.utils.DateUtils; import kr.xit.ens.kt.service.IKtMmsService; import lombok.RequiredArgsConstructor; @@ -143,13 +147,29 @@ public class BizKtMmsService extends EgovAbstractServiceImpl implements IBizKtMm } @Override - public KtCommonResponse cfmToken(final KtTokenDTO.KtTokenConfirmRequest reqDTO) { - //final CmmEnsRlaybsnmDTO ktMnsInfo = CmmKtMmsUtils.getRlaybsnmInfo(reqDTO.getSignguCode(), reqDTO.getFfnlgCode()); - //reqDTO.setServiceCd(ktMnsInfo.get); - //reqDTO.setServiceKey(ktMnsInfo.get); - //CmmEnsUtils.validate(reqDTO); + public String findKtMblData(final KtTokenDTO.KtTokenConfirmRequest reqDTO) { + if (Checks.isEmpty(reqDTO.getAccessToken())) + throw BizRuntimeException.create(String.valueOf(ErrorCode.BAD_REQUEST.getHttpStatus().value()), "정상적인 요청이 아닙니다. 재인증 후 시도하시기 바랍니다."); - return null; + KtTokenConfirmResponse cfmRes = ktMmsService.cfmToken(reqDTO); + if(cfmRes.getResultCd().equals("00")){ + + + KtCommonResponse readRes = ktMmsService.readToken( + KtTokenReadRequest.builder() + .accessToken(reqDTO.getAccessToken()) + .build() + ); + if(readRes.getResultCd().equals("00")){ + String srcKey = cfmRes.getSrcKey(); + //TODO:: srckey로 컨텐츠 조회후 결과 return + return null; + } + //List errorMsgs = readRes.getErrors(); + //String.join(",", Arrays.stream(errorMsgs).toArray()) + throw BizRuntimeException.create("~~~~열람확인 오류~~~~"); + } + throw BizRuntimeException.create("~~~~토큰인증확인 오류~~~~"); } @Override diff --git a/mens-api/src/main/java/kr/xit/biz/kt/service/IBizKtMmsService.java b/mens-api/src/main/java/kr/xit/biz/kt/service/IBizKtMmsService.java index 5095427..d93ebfe 100644 --- a/mens-api/src/main/java/kr/xit/biz/kt/service/IBizKtMmsService.java +++ b/mens-api/src/main/java/kr/xit/biz/kt/service/IBizKtMmsService.java @@ -27,7 +27,7 @@ public interface IBizKtMmsService { KtTokenResponse requestToken(final KtMnsRequest paramDTO); KtCommonResponse mainSend(final KtMnsRequest reqDTO); - KtCommonResponse cfmToken(final KtTokenConfirmRequest reqDTO); + String findKtMblData(final KtTokenConfirmRequest reqDTO); KtCommonResponse messageResult(final KtMnsRequest reqDTO); diff --git a/mens-api/src/main/java/kr/xit/biz/kt/web/BizKtMmsController.java b/mens-api/src/main/java/kr/xit/biz/kt/web/BizKtMmsController.java index 48c04a9..adf317d 100644 --- a/mens-api/src/main/java/kr/xit/biz/kt/web/BizKtMmsController.java +++ b/mens-api/src/main/java/kr/xit/biz/kt/web/BizKtMmsController.java @@ -4,6 +4,8 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.ExampleObject; import io.swagger.v3.oas.annotations.tags.Tag; +import kr.xit.biz.common.ApiConstants; +import kr.xit.biz.common.ApiConstants.SignguCode; import kr.xit.biz.ens.model.kt.KtCommonDTO.KtCommonResponse; import kr.xit.biz.ens.model.kt.KtCommonDTO.KtMnsRequest; import kr.xit.biz.ens.model.kt.KtTokenDTO.KtTokenConfirmRequest; @@ -115,14 +117,31 @@ public class BizKtMmsController { - @Operation(summary = "토큰인증확인 조회", description = "토큰인증확인조회요청(BC-AG-SN-008)") - @RequestMapping(method = {RequestMethod.GET, RequestMethod.POST}, value = "/cfmToken", produces = MediaType.APPLICATION_JSON_VALUE) - public IApiResponse cfmToken(@RequestBody final KtTokenConfirmRequest reqDTO) { - //public IApiResponse cfmToken(@RequestBody final Map reqDTO) { - KtCommonResponse dto = service.cfmToken(reqDTO); - return ApiResponseDTO.success(dto); + @Operation(summary = "토큰인증확인 조회(교통시설처)", description = "토큰인증확인조회요청(BC-AG-SN-008)-교통시설처") + @RequestMapping(method = {RequestMethod.GET, RequestMethod.POST}, value = "/cfmTokenDp", produces = MediaType.APPLICATION_JSON_VALUE) + public IApiResponse cfmTokenDp(@RequestBody final String token) { + String mblData = service.findKtMblData( + KtTokenConfirmRequest.builder() + .signguCode(SignguCode.TRAFFIC.getCode()) + .ffnlgCode(ApiConstants.FFNLN_CODE) + .accessToken(token) + .build() + ); + return ApiResponseDTO.success(mblData); } + @Operation(summary = "토큰인증확인 조회(승화원)", description = "토큰인증확인조회요청(BC-AG-SN-008)-승화원") + @RequestMapping(method = {RequestMethod.GET, RequestMethod.POST}, value = "/cfmTokenMe", produces = MediaType.APPLICATION_JSON_VALUE) + public IApiResponse cfmTokenMe(@RequestBody final String token) { + String mblData = service.findKtMblData( + KtTokenConfirmRequest.builder() + .signguCode(SignguCode.FUNERAL.getCode()) + .ffnlgCode(ApiConstants.FFNLN_CODE) + .accessToken(token) + .build() + ); + return ApiResponseDTO.success(mblData); + } // // /* diff --git a/mens-api/src/main/java/kr/xit/ens/kt/service/IKtMmsService.java b/mens-api/src/main/java/kr/xit/ens/kt/service/IKtMmsService.java index a98d8dc..7924d85 100644 --- a/mens-api/src/main/java/kr/xit/ens/kt/service/IKtMmsService.java +++ b/mens-api/src/main/java/kr/xit/ens/kt/service/IKtMmsService.java @@ -23,6 +23,7 @@ import kr.xit.biz.ens.model.kt.KtMmsSendDTO.KtBefSendRequest; import kr.xit.biz.ens.model.kt.KtMmsSendDTO.KtMainSendRequest; import kr.xit.biz.ens.model.kt.KtMmsSendDTO.KtMsgRsltRequest; import kr.xit.biz.ens.model.kt.KtTokenDTO.KtTokenConfirmRequest; +import kr.xit.biz.ens.model.kt.KtTokenDTO.KtTokenConfirmResponse; import kr.xit.biz.ens.model.kt.KtTokenDTO.KtTokenExcaRequest; import kr.xit.biz.ens.model.kt.KtTokenDTO.KtTokenReadRequest; import kr.xit.biz.ens.model.kt.KtTokenDTO.KtTokenResponse; @@ -49,7 +50,7 @@ public interface IKtMmsService { //------------------------------------------------------------------------------ KtTokenResponse requestToken(final KtMnsRequest paramDTO); KtCommonResponse mainSend(final KtMainSendRequest reqDTO); - KtCommonResponse cfmToken(final KtTokenConfirmRequest reqDTO); + KtTokenConfirmResponse cfmToken(final KtTokenConfirmRequest reqDTO); KtCommonResponse readToken(final KtTokenReadRequest reqDTO); KtCommonResponse messageResult(final KtMsgRsltRequest reqDTO); //------------------------------------------------------------------------------ diff --git a/mens-api/src/main/java/kr/xit/ens/kt/service/KtMmsService.java b/mens-api/src/main/java/kr/xit/ens/kt/service/KtMmsService.java index 7fb5292..36bda51 100644 --- a/mens-api/src/main/java/kr/xit/ens/kt/service/KtMmsService.java +++ b/mens-api/src/main/java/kr/xit/ens/kt/service/KtMmsService.java @@ -25,6 +25,7 @@ import kr.xit.biz.ens.model.kt.KtMmsSendDTO.KtBefSendRequest; import kr.xit.biz.ens.model.kt.KtMmsSendDTO.KtMainSendRequest; import kr.xit.biz.ens.model.kt.KtMmsSendDTO.KtMsgRsltRequest; import kr.xit.biz.ens.model.kt.KtTokenDTO; +import kr.xit.biz.ens.model.kt.KtTokenDTO.KtTokenConfirmResponse; import kr.xit.biz.ens.model.kt.KtTokenDTO.KtTokenExcaRequest; import kr.xit.biz.ens.model.kt.KtTokenDTO.KtTokenReadRequest; import kr.xit.biz.ens.model.kt.KtTokenDTO.KtTokenRequest; @@ -220,11 +221,10 @@ public class KtMmsService extends EgovAbstractServiceImpl implements IKtMmsServi @Override @TraceLogging - public KtCommonResponse cfmToken(final KtTokenDTO.KtTokenConfirmRequest reqDTO) { + public KtTokenConfirmResponse cfmToken(final KtTokenDTO.KtTokenConfirmRequest reqDTO) { final CmmEnsRlaybsnmDTO ktMnsInfo = CmmKtMmsUtils.getRlaybsnmInfo(reqDTO.getSignguCode(), reqDTO.getFfnlgCode()); reqDTO.setServiceCd(ktMnsInfo.getKtServiceCode()); reqDTO.setServiceKey(ktMnsInfo.getKtSvcCerfKey()); - reqDTO.setAccessToken(ktMnsInfo.getKtAccessToken()); reqDTO.setSignguCode(null); reqDTO.setFfnlgCode(null); reqDTO.setProfile(null); @@ -234,7 +234,7 @@ public class KtMmsService extends EgovAbstractServiceImpl implements IKtMmsServi HOST + API_CFM_TOKEN, HttpMethod.POST, JsonUtils.toJson(reqDTO), - KtCommonResponse.class, + KtTokenConfirmResponse.class, ktMnsInfo ); } @@ -245,7 +245,6 @@ public class KtMmsService extends EgovAbstractServiceImpl implements IKtMmsServi final CmmEnsRlaybsnmDTO ktMnsInfo = CmmKtMmsUtils.getRlaybsnmInfo(reqDTO.getSignguCode(), reqDTO.getFfnlgCode()); reqDTO.setServiceCd(ktMnsInfo.getKtServiceCode()); reqDTO.setServiceKey(ktMnsInfo.getKtSvcCerfKey()); - reqDTO.setAccessToken(ktMnsInfo.getKtAccessToken()); reqDTO.setMmsRdgTmst(DateUtils.getTodayAndNowTime("yyyyMMddHHmmss")); reqDTO.setSignguCode(null); reqDTO.setFfnlgCode(null); diff --git a/mens-api/src/main/resources/config/application-ens.yml b/mens-api/src/main/resources/config/application-ens.yml index 3f9772b..bb5d872 100644 --- a/mens-api/src/main/resources/config/application-ens.yml +++ b/mens-api/src/main/resources/config/application-ens.yml @@ -57,7 +57,7 @@ contract: # 사전/본 문자 발송/수신 결과 전송 : BC-AG-SN-010 result-message: /api/ag/message/result # 토큰인증확인 : 본문자수신등록 callback url - dp-callback-url: http://211.119.124.7:8081/api/biz/kt/v1/cfmTokenDP + dp-callback-url: http://211.119.124.7:8081/api/biz/kt/v1/cfmTokenDp me-callback-url: http://211.119.124.7:8081/api/biz/kt/v1/cfmTokenMe # 사전문자수신등록 : BC-AG-SN-001 diff --git a/mens-core/src/main/java/kr/xit/biz/common/ApiConstants.java b/mens-core/src/main/java/kr/xit/biz/common/ApiConstants.java index 44a9356..a422a25 100644 --- a/mens-core/src/main/java/kr/xit/biz/common/ApiConstants.java +++ b/mens-core/src/main/java/kr/xit/biz/common/ApiConstants.java @@ -21,6 +21,8 @@ import lombok.Getter; */ public class ApiConstants { + public static final String FFNLN_CODE = "11"; + /** *
      * 문서 조회 버튼의 명칭을 구분하기 위한 값
diff --git a/mens-core/src/main/java/kr/xit/biz/ens/model/kt/KtTokenDTO.java b/mens-core/src/main/java/kr/xit/biz/ens/model/kt/KtTokenDTO.java
index dcd5897..7734bfd 100644
--- a/mens-core/src/main/java/kr/xit/biz/ens/model/kt/KtTokenDTO.java
+++ b/mens-core/src/main/java/kr/xit/biz/ens/model/kt/KtTokenDTO.java
@@ -27,7 +27,7 @@ import org.hibernate.validator.constraints.NotEmpty;
  *                 Response: {@link KtTokenResponse}
  *               - Token 인증 확인 조회(BC-AG-SN-008)
  *                 Request: {@link KtTokenConfirmRequest}
- *                 Response: {@link KtCommonResponse}
+ *                 Response: {@link KtTokenConfirmResponse}
  *               - 열람확인결과전송(BC-AG-SN-009)
  *                 Request : {@link KtTokenReadRequest}
  *                 Response : {@link KtCommonResponse}
@@ -178,7 +178,7 @@ public class KtTokenDTO {
      * 
      * Token 인증 확인 조회 : BC-AG-SN-008
      * Request : KtTokenConfirmRequest
-     * Response : KtCommonResponse
+     * Response : KtTokenConfirmResponse
      * 
*/ @Schema(name = "KtTokenConfirmRequest", description = "KT 토큰 인증 확인 요청 DTO") @@ -218,7 +218,23 @@ public class KtTokenDTO { @NotEmpty(message = "토큰은 필수 입니다") private String accessToken; } - //---------------------------------------------------------------------------------------- + + @Schema(name = "KtTokenConfirmResponse", description = "KT 토큰 인증 확인 요청 결과 DTO") + @Getter + @NoArgsConstructor + @AllArgsConstructor + @SuperBuilder + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) + public static class KtTokenConfirmResponse extends KtCommonResponse { + /** + *
+         * 관리키 : 고객 메시지 건별 Unique한 키 - max 50
+         * 
+ */ + @Schema(requiredMode = RequiredMode.REQUIRED, title = "관리키") + private String srcKey; + } /** *