feat: kt BC/GIBIS 모바일 페이지 조회 반영

main
Jonguk. Lim 3 months ago
parent 305ab144bc
commit 12ee3f1599

@ -2,7 +2,6 @@ package kr.xit.biz.mbl.mapper;
import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
import kr.xit.biz.ens.model.cntc.CntcDTO;
import kr.xit.biz.mbl.model.MobilePageDTO;
import kr.xit.biz.mbl.model.MobilePageDTO.MobilePageManage;
@ -26,6 +25,7 @@ public interface IMobilePageMapper {
// FIXME: kakao v1 or v2
MobilePageManage selectKkopayMobilePage(final MobilePageDTO.KakaoValidTokenRequest dto);
MobilePageManage selectKkotalkMobilePage(final MobilePageDTO.KakaoValidTokenRequest dto);
<T> MobilePageManage selectKtMobilePage(final T t);
MobilePageManage selectXitMobilePage(final CntcDTO.XitPage dto);
<T> MobilePageManage selectKtBcMobilePage(final T t);
<T> MobilePageManage selectKtGbsMobilePage(final T t);
}

@ -1,9 +1,8 @@
package kr.xit.biz.mbl.service;
import kr.xit.biz.ens.model.cntc.CntcDTO;
import kr.xit.biz.ens.model.kt.KtTokenDTO.KtTokenConfirmRequest;
import kr.xit.biz.ens.model.ktgbs.KtGbsDTO;
import kr.xit.biz.mbl.model.MobilePageDTO;
import kr.xit.core.model.IApiResponse;
/**
* <pre>
@ -25,7 +24,6 @@ public interface IMobilePageService {
String findKkopayReadyAndMblPage(MobilePageDTO.KakaoValidTokenRequest reqDTO);
String findKkotalkReadyAndMblPage(MobilePageDTO.KakaoValidTokenRequest reqDTO);
IApiResponse findKtMblPage(final KtTokenConfirmRequest reqDTO);
IApiResponse findXitkkopayReadyAndMblPage(final CntcDTO.XitPage reqDTO);
String findKtBcMblPage(final KtTokenConfirmRequest reqDTO);
String findKtGbsMblPage(final KtGbsDTO.TokenConfirmRequest reqDTO);
}

@ -2,24 +2,25 @@ package kr.xit.biz.mbl.service;
import org.springframework.stereotype.Service;
import kr.xit.biz.ens.model.cntc.CntcDTO;
import kr.xit.biz.ens.model.kakao.pay.KkopayDocDTO;
import kr.xit.biz.ens.model.kakao.talk.KkotalkApiDTO;
import kr.xit.biz.ens.model.kt.KtCommonDTO;
import kr.xit.biz.ens.model.kt.KtTokenDTO;
import kr.xit.biz.ens.model.ktgbs.KtGbsDTO;
import kr.xit.biz.mbl.mapper.IMobilePageMapper;
import kr.xit.biz.mbl.model.MobilePageDTO;
import kr.xit.biz.mbl.model.MobilePageDTO.MobilePageManage;
import kr.xit.core.consts.ErrorCode;
import kr.xit.core.exception.BizRuntimeException;
import kr.xit.core.model.ApiResponseDTO;
import kr.xit.core.model.IApiResponse;
import kr.xit.core.service.AbstractService;
import kr.xit.core.spring.annotation.TraceLogging;
import kr.xit.core.support.utils.Checks;
import kr.xit.core.support.utils.DateUtils;
import kr.xit.ens.kakao.pay.service.IKkopayEltrcDocService;
import kr.xit.ens.kakao.talk.service.IKkotalkEltrcDocService;
import kr.xit.ens.kt.service.IKtBcService;
import kr.xit.ens.ktgbs.service.IKtGbsService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@ -45,7 +46,8 @@ public class MobilePageService extends AbstractService implements IMobilePageSer
private final IMobilePageMapper mapper;
private final IKkopayEltrcDocService kkopayService;
private final IKkotalkEltrcDocService kkotalkService;
private final IKtBcService ktMmsService;
private final IKtBcService ktBcService;
private final IKtGbsService ktGbsService;
/**
* <pre>
@ -131,7 +133,7 @@ public class MobilePageService extends AbstractService implements IMobilePageSer
/**
* <pre>
* KT
* KT BC
* - (BC-AG-SN-002) API
* -> url(callback)
* -> callback url ? token=...
@ -146,21 +148,21 @@ public class MobilePageService extends AbstractService implements IMobilePageSer
*/
@Override
@TraceLogging
public IApiResponse findKtMblPage(final KtTokenDTO.KtTokenConfirmRequest reqDTO) {
public String findKtBcMblPage(final KtTokenDTO.KtTokenConfirmRequest reqDTO) {
//TODO::테스트
//MobilePageManage mblDTO = mapper.selectKtMobilePage("DPDKT202311080000111");
//return ApiResponseDTO.success(mblDTO.getMobilePageCn());
//TODO::실운영시 코멘트 제거
if (Checks.isEmpty(reqDTO.getAccessToken()))
throw BizRuntimeException.create(String.valueOf(ErrorCode.BAD_REQUEST.getHttpStatus().value()), "KT 안심문자 정상 요청이 아닙니다. 재인증 후 시도하시기 바랍니다.");
throw BizRuntimeException.create(String.valueOf(ErrorCode.BAD_REQUEST.getHttpStatus().value()), "KT BC 안심문자 정상 요청이 아닙니다. 재인증 후 시도하시기 바랍니다.");
final String signguCode = reqDTO.getSignguCode();
final String ffnlgCode = reqDTO.getFfnlgCode();
final KtTokenDTO.KtTokenConfirmResponse cfmRes = ktMmsService.cfmToken(reqDTO);
final KtTokenDTO.KtTokenConfirmResponse cfmRes = ktBcService.cfmToken(reqDTO);
if(cfmRes.getResultCd().equals("00")){
KtCommonDTO.KtCommonResponse readRes = ktMmsService.readToken(
KtCommonDTO.KtCommonResponse readRes = ktBcService.readToken(
KtTokenDTO.KtTokenReadRequest.builder()
.signguCode(signguCode)
.ffnlgCode(ffnlgCode)
@ -170,8 +172,8 @@ public class MobilePageService extends AbstractService implements IMobilePageSer
if(readRes.getResultCd().equals("00")){
String srcKey = cfmRes.getSrcKey();
final MobilePageManage mobilePageManage = mapper.selectKtMobilePage(srcKey);
return ApiResponseDTO.success(mobilePageManage.getMobilePageCn());
final MobilePageManage mobilePageManage = mapper.selectKtBcMobilePage(srcKey);
return mobilePageManage.getMobilePageCn();
}
throw BizRuntimeException.create(readRes.getResultCd(), readRes.toStringErrorMsg());
}
@ -180,21 +182,51 @@ public class MobilePageService extends AbstractService implements IMobilePageSer
/**
* <pre>
* XIT </h3>
* - : unitySndngDetailId
* - redirect url
*
* @param reqDTO CntcDTO.XitPage
* KT GIBIS
* - API
* -> url(callback)
* -> callback url ? token=...
* 1. API call
* 2. API call
* -> srcKey
* 3. kt BIBIS
* -> return
* @param reqDTO KtTokenConfirmRequest
* @return
* </pre>
*/
@Override
@TraceLogging
public IApiResponse findXitkkopayReadyAndMblPage(final CntcDTO.XitPage reqDTO) {
public String findKtGbsMblPage(final KtGbsDTO.TokenConfirmRequest reqDTO) {
//TODO::테스트
//MobilePageManage mblDTO = mapper.selectKtMobilePage("DPDKT202311080000111");
//return ApiResponseDTO.success(mblDTO.getMobilePageCn());
//TODO::실운영시 코멘트 제거
if (Checks.isEmpty(reqDTO.getToken()))
throw BizRuntimeException.create(String.valueOf(ErrorCode.BAD_REQUEST.getHttpStatus().value()), "KT GIBIS 안심문자 정상 요청이 아닙니다. 재인증 후 시도하시기 바랍니다.");
// unitySndngDetailId로 데이타 조회
final MobilePageManage mobilePageManage = mapper.selectXitMobilePage(reqDTO);
if(mobilePageManage == null) throw BizRuntimeException.create("데이타 오류[내문서함 문서가 없습니다]");
final String signguCode = reqDTO.getSignguCode();
final String ffnlgCode = reqDTO.getFfnlgCode();
final KtCommonDTO.KtCommonResponse cfmRes = ktGbsService.cfmToken(reqDTO);
return ApiResponseDTO.success(mobilePageManage.getMobilePageCn());
if(cfmRes.getResultCd().equals("00")){
KtCommonDTO.KtCommonResponse readRes = ktGbsService.readToken(
KtGbsDTO.TokenReadRequest.builder()
.signguCode(signguCode)
.ffnlgCode(ffnlgCode)
.accessToken(reqDTO.getToken())
.mmsRdgTmst(DateUtils.getTodayAndNowTime("yyyyMMddHHmmss"))
.build()
);
if(readRes.getResultCd().equals("00")){
String srcKey = reqDTO.getSrcKey();
final MobilePageManage mobilePageManage = mapper.selectKtGbsMobilePage(srcKey);
return mobilePageManage.getMobilePageCn();
}
throw BizRuntimeException.create(readRes.getResultCd(), readRes.toStringErrorMsg());
}
throw BizRuntimeException.create(cfmRes.getResultCd(), cfmRes.toStringErrorMsg());
}
}

@ -6,7 +6,6 @@ import org.apache.commons.lang.StringUtils;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
@ -17,12 +16,11 @@ import io.swagger.v3.oas.annotations.Operation;
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.cntc.CntcDTO;
import kr.xit.biz.ens.model.kt.KtTokenDTO;
import kr.xit.biz.ens.model.ktgbs.KtGbsDTO;
import kr.xit.biz.mbl.model.MobilePageDTO;
import kr.xit.biz.mbl.service.IMobilePageService;
import kr.xit.core.exception.BizRuntimeException;
import kr.xit.core.model.IApiResponse;
import lombok.RequiredArgsConstructor;
/**
@ -85,6 +83,9 @@ public class MobilePageController {
/**
* <pre>
* KT
* /kt/mblPage/old - ( API )
* /kt/mblPage/canES -
* /kt/mblPage/canWB -
* - (BC-AG-SN-002) API
* -> url(callback)
* -> callback url ? token=...
@ -103,37 +104,56 @@ public class MobilePageController {
*/
@Operation(summary = "KT 모바일 데이타 요청(모바일 페이지에서 호출)", description = "KT 모바일 데이타 요청(모바일 페이지에서 호출)")
@PostMapping(
value = {"/kt/dpMblPage", "/kt/meMblPage"},
value = {"/kt/mblPage/old", "/kt/mblPage/canES", "/kt/mblPage/canWN"},
produces = MediaType.APPLICATION_JSON_VALUE)
public IApiResponse findKtMblPage(@RequestParam final String token, final HttpServletRequest request) {
public ModelAndView findKtMblPage(@RequestParam final String token, final HttpServletRequest request) {
final String uri = request.getRequestURI();
//FIXME: KT mblpage 적용 안됨
final KtTokenDTO.KtTokenConfirmRequest cfmReqDTO = KtTokenDTO.KtTokenConfirmRequest.builder()
.signguCode(SignguCode.CHUNCHEON.getCode())
.ffnlgCode(ApiConstants.FFNLN_CODE)
.accessToken(token)
.build();
String mblCnts = "";
//FIXME: KT mblpage 적용 안됨
if(uri.contains("meMblPage")){
cfmReqDTO.setSignguCode(SignguCode.CHEONAN_ES.getCode());
//cfmReqDTO.setSignguCode(SignguCode.CHEONAN_WN.getCode());
}
return service.findKtMblPage(cfmReqDTO);
}
ModelAndView mav = new ModelAndView();
mav.setViewName("/notiprnt");
/**
* <pre>
* XIT
* - mens-web : {@code EnsInboundApiController.findXitMblPage}
* <a href="http://localhost:8080/api/web/mbl/v1/xit/mblPage.do">xit mobile page</a>
* @param reqDTO CntcDTO.XitPage
* @return IApiResponse String return
* </pre>
*/
@Operation(summary = "XIT 모바일 데이타 요청(모바일 페이지에서 호출)", description = "XIT 모바일 데이타 요청(모바일 페이지에서 호출)")
@PostMapping(value = "/xit/mblPage", produces = MediaType.APPLICATION_JSON_VALUE)
public IApiResponse findXitMyDocReadyAndMblData(@RequestBody final CntcDTO.XitPage reqDTO) {
return service.findXitkkopayReadyAndMblPage(reqDTO);
try{
switch (uri) {
case "/kt/mblPage/canES":
mblCnts = service.findKtGbsMblPage(
KtGbsDTO.TokenConfirmRequest.builder()
.signguCode(SignguCode.CHEONAN_ES.getCode())
.ffnlgCode(ApiConstants.FFNLN_CODE)
.token(token)
.build()
);
break;
case "/kt/mblPage/canWN":
mblCnts = service.findKtGbsMblPage(
KtGbsDTO.TokenConfirmRequest.builder()
.signguCode(SignguCode.CHEONAN_WN.getCode())
.ffnlgCode(ApiConstants.FFNLN_CODE)
.token(token)
.build()
);
break;
case "/kt/mblPage/old":
//FIXME: KT mblpage 적용 안됨
mblCnts = service.findKtBcMblPage(
KtTokenDTO.KtTokenConfirmRequest.builder()
.signguCode("")
.ffnlgCode(ApiConstants.FFNLN_CODE)
.accessToken(token)
.build()
);
default:
throw BizRuntimeException.create(String.format("정상적인 요청이 아닙니다. 요청 url을 확인해 주세요.\n(요청 URL: %s)", uri));
}
mav.addObject("details", mblCnts);
}catch (Exception e){
mav.addObject("errCode", e.getMessage());
mav.addObject("errMsg", e.getMessage());
}
return mav;
}
}

@ -31,22 +31,14 @@
AND tekmd.external_id = #{externalId}
</select>
<select id="selectKtMobilePage" resultType="kr.xit.biz.mbl.model.MobilePageDTO$MobilePageManage">
/** ens-mbl-mysql-mapper|selectKtMobilePage-KT 모바일 페이지 콘텐트 조회|julim */
SELECT tempm.sndng_detail_id
, tempm.sndng_se_code
, tempm.mobile_page_cn
FROM tb_ens_kt_bc_detail tekbd
JOIN tb_ens_mobile_page_manage tempm
ON tekbd.sndng_detail_id = tempm.sndng_detail_id
WHERE tekbd.src_key = #{srcKey}
</select>
<select id="selectXitMobilePage" resultType="kr.xit.biz.mbl.model.MobilePageDTO$MobilePageManage">
/** ens-mbl-mysql-mapper|selectXitMobilePage-XIT 모바일 페이지 콘텐트 조회|jhseo */
SELECT tempm.mobile_page_cn
FROM tb_ens_mobile_page_manage tempm
WHERE sndng_detail_id = #{unitySndngDetailId}
<select id="selectKtBcMobilePage" resultType="kr.xit.biz.mbl.model.MobilePageDTO$MobilePageManage">
/** ens-mbl-mysql-mapper|selectKtBcMobilePage-KT BC 모바일 페이지 콘텐트 조회|julim */
SELECT tempm.sndng_detail_id
, tempm.sndng_se_code
, tempm.mobile_page_cn
FROM tb_ens_kt_bc_detail tekbd
JOIN tb_ens_mobile_page_manage tempm
ON tekbd.sndng_detail_id = tempm.sndng_detail_id
WHERE tekbd.src_key = #{srcKey}
</select>
</mapper>

@ -31,22 +31,26 @@
AND tekmd.external_id = #{externalId}
</select>
<select id="selectKtMobilePage" resultType="kr.xit.biz.mbl.model.MobilePageDTO$MobilePageManage">
/** ens-mbl-oracle-mapper|selectKtMobilePage-KT 모바일 페이지 콘텐트 조회|julim */
SELECT tempm.sndng_detail_id
, tempm.sndng_se_code
, tempm.mobile_page_cn
FROM tb_ens_kt_bc_detail tekbd
JOIN tb_ens_mobile_page_manage tempm
ON tekbd.sndng_detail_id = tempm.sndng_detail_id
WHERE tekbd.src_key = #{srcKey}
<select id="selectKtBcMobilePage" resultType="kr.xit.biz.mbl.model.MobilePageDTO$MobilePageManage">
/** ens-mbl-oracle-mapper|selectKtBcMobilePage-KT BC 모바일 페이지 콘텐트 조회|julim */
SELECT tempm.sndng_detail_id
, tempm.sndng_se_code
, tempm.mobile_page_cn
FROM tb_ens_kt_bc_detail tekbd
JOIN tb_ens_mobile_page_manage tempm
ON tekbd.sndng_detail_id = tempm.sndng_detail_id
WHERE tekbd.src_key = #{srcKey}
</select>
<select id="selectXitMobilePage" resultType="kr.xit.biz.mbl.model.MobilePageDTO$MobilePageManage">
/** ens-mbl-oracle-mapper|selectXitMobilePage-XIT 모바일 페이지 콘텐트 조회|jhseo */
SELECT tempm.mobile_page_cn
FROM tb_ens_mobile_page_manage tempm
WHERE sndng_detail_id = #{unitySndngDetailId}
</select>
<select id="selectKtGbsMobilePage" resultType="kr.xit.biz.mbl.model.MobilePageDTO$MobilePageManage">
/** ens-mbl-mysql-mapper|selectKtGbsMobilePage-KT GIBIS 모바일 페이지 콘텐트 조회|julim */
SELECT tempm.sndng_detail_id
, tempm.sndng_se_code
, tempm.mobile_page_cn
FROM tb_ens_kt_gbs tekg
JOIN tb_ens_mobile_page_manage tempm
ON tekg.sndng_detail_id = tempm.sndng_detail_id
WHERE tekg.src_key = #{srcKey}
</select>
</mapper>

Loading…
Cancel
Save