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 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;
import kr.xit.biz.mbl.model.MobilePageDTO.MobilePageManage; import kr.xit.biz.mbl.model.MobilePageDTO.MobilePageManage;
@ -26,6 +25,7 @@ public interface IMobilePageMapper {
// FIXME: kakao v1 or v2 // FIXME: kakao v1 or v2
MobilePageManage selectKkopayMobilePage(final MobilePageDTO.KakaoValidTokenRequest dto); MobilePageManage selectKkopayMobilePage(final MobilePageDTO.KakaoValidTokenRequest dto);
MobilePageManage selectKkotalkMobilePage(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; 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.kt.KtTokenDTO.KtTokenConfirmRequest;
import kr.xit.biz.ens.model.ktgbs.KtGbsDTO;
import kr.xit.biz.mbl.model.MobilePageDTO; import kr.xit.biz.mbl.model.MobilePageDTO;
import kr.xit.core.model.IApiResponse;
/** /**
* <pre> * <pre>
@ -25,7 +24,6 @@ public interface IMobilePageService {
String findKkopayReadyAndMblPage(MobilePageDTO.KakaoValidTokenRequest reqDTO); String findKkopayReadyAndMblPage(MobilePageDTO.KakaoValidTokenRequest reqDTO);
String findKkotalkReadyAndMblPage(MobilePageDTO.KakaoValidTokenRequest reqDTO); String findKkotalkReadyAndMblPage(MobilePageDTO.KakaoValidTokenRequest reqDTO);
IApiResponse findKtMblPage(final KtTokenConfirmRequest reqDTO); String findKtBcMblPage(final KtTokenConfirmRequest reqDTO);
String findKtGbsMblPage(final KtGbsDTO.TokenConfirmRequest reqDTO);
IApiResponse findXitkkopayReadyAndMblPage(final CntcDTO.XitPage reqDTO);
} }

@ -2,24 +2,25 @@ package kr.xit.biz.mbl.service;
import org.springframework.stereotype.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.pay.KkopayDocDTO;
import kr.xit.biz.ens.model.kakao.talk.KkotalkApiDTO; import kr.xit.biz.ens.model.kakao.talk.KkotalkApiDTO;
import kr.xit.biz.ens.model.kt.KtCommonDTO; import kr.xit.biz.ens.model.kt.KtCommonDTO;
import kr.xit.biz.ens.model.kt.KtTokenDTO; 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.mapper.IMobilePageMapper;
import kr.xit.biz.mbl.model.MobilePageDTO; import kr.xit.biz.mbl.model.MobilePageDTO;
import kr.xit.biz.mbl.model.MobilePageDTO.MobilePageManage; import kr.xit.biz.mbl.model.MobilePageDTO.MobilePageManage;
import kr.xit.core.consts.ErrorCode; import kr.xit.core.consts.ErrorCode;
import kr.xit.core.exception.BizRuntimeException; import kr.xit.core.exception.BizRuntimeException;
import kr.xit.core.model.ApiResponseDTO; import kr.xit.core.model.ApiResponseDTO;
import kr.xit.core.model.IApiResponse;
import kr.xit.core.service.AbstractService; import kr.xit.core.service.AbstractService;
import kr.xit.core.spring.annotation.TraceLogging; import kr.xit.core.spring.annotation.TraceLogging;
import kr.xit.core.support.utils.Checks; 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.pay.service.IKkopayEltrcDocService;
import kr.xit.ens.kakao.talk.service.IKkotalkEltrcDocService; import kr.xit.ens.kakao.talk.service.IKkotalkEltrcDocService;
import kr.xit.ens.kt.service.IKtBcService; import kr.xit.ens.kt.service.IKtBcService;
import kr.xit.ens.ktgbs.service.IKtGbsService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -45,7 +46,8 @@ public class MobilePageService extends AbstractService implements IMobilePageSer
private final IMobilePageMapper mapper; private final IMobilePageMapper mapper;
private final IKkopayEltrcDocService kkopayService; private final IKkopayEltrcDocService kkopayService;
private final IKkotalkEltrcDocService kkotalkService; private final IKkotalkEltrcDocService kkotalkService;
private final IKtBcService ktMmsService; private final IKtBcService ktBcService;
private final IKtGbsService ktGbsService;
/** /**
* <pre> * <pre>
@ -131,7 +133,7 @@ public class MobilePageService extends AbstractService implements IMobilePageSer
/** /**
* <pre> * <pre>
* KT * KT BC
* - (BC-AG-SN-002) API * - (BC-AG-SN-002) API
* -> url(callback) * -> url(callback)
* -> callback url ? token=... * -> callback url ? token=...
@ -146,21 +148,21 @@ public class MobilePageService extends AbstractService implements IMobilePageSer
*/ */
@Override @Override
@TraceLogging @TraceLogging
public IApiResponse findKtMblPage(final KtTokenDTO.KtTokenConfirmRequest reqDTO) { public String findKtBcMblPage(final KtTokenDTO.KtTokenConfirmRequest reqDTO) {
//TODO::테스트 //TODO::테스트
//MobilePageManage mblDTO = mapper.selectKtMobilePage("DPDKT202311080000111"); //MobilePageManage mblDTO = mapper.selectKtMobilePage("DPDKT202311080000111");
//return ApiResponseDTO.success(mblDTO.getMobilePageCn()); //return ApiResponseDTO.success(mblDTO.getMobilePageCn());
//TODO::실운영시 코멘트 제거 //TODO::실운영시 코멘트 제거
if (Checks.isEmpty(reqDTO.getAccessToken())) 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 signguCode = reqDTO.getSignguCode();
final String ffnlgCode = reqDTO.getFfnlgCode(); final String ffnlgCode = reqDTO.getFfnlgCode();
final KtTokenDTO.KtTokenConfirmResponse cfmRes = ktMmsService.cfmToken(reqDTO); final KtTokenDTO.KtTokenConfirmResponse cfmRes = ktBcService.cfmToken(reqDTO);
if(cfmRes.getResultCd().equals("00")){ if(cfmRes.getResultCd().equals("00")){
KtCommonDTO.KtCommonResponse readRes = ktMmsService.readToken( KtCommonDTO.KtCommonResponse readRes = ktBcService.readToken(
KtTokenDTO.KtTokenReadRequest.builder() KtTokenDTO.KtTokenReadRequest.builder()
.signguCode(signguCode) .signguCode(signguCode)
.ffnlgCode(ffnlgCode) .ffnlgCode(ffnlgCode)
@ -170,8 +172,8 @@ public class MobilePageService extends AbstractService implements IMobilePageSer
if(readRes.getResultCd().equals("00")){ if(readRes.getResultCd().equals("00")){
String srcKey = cfmRes.getSrcKey(); String srcKey = cfmRes.getSrcKey();
final MobilePageManage mobilePageManage = mapper.selectKtMobilePage(srcKey); final MobilePageManage mobilePageManage = mapper.selectKtBcMobilePage(srcKey);
return ApiResponseDTO.success(mobilePageManage.getMobilePageCn()); return mobilePageManage.getMobilePageCn();
} }
throw BizRuntimeException.create(readRes.getResultCd(), readRes.toStringErrorMsg()); throw BizRuntimeException.create(readRes.getResultCd(), readRes.toStringErrorMsg());
} }
@ -180,21 +182,51 @@ public class MobilePageService extends AbstractService implements IMobilePageSer
/** /**
* <pre> * <pre>
* XIT </h3> * KT GIBIS
* - : unitySndngDetailId * - API
* - redirect url * -> url(callback)
* * -> callback url ? token=...
* @param reqDTO CntcDTO.XitPage * 1. API call
* 2. API call
* -> srcKey
* 3. kt BIBIS
* -> return
* @param reqDTO KtTokenConfirmRequest
* @return
* </pre> * </pre>
*/ */
@Override @Override
@TraceLogging @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 String signguCode = reqDTO.getSignguCode();
final MobilePageManage mobilePageManage = mapper.selectXitMobilePage(reqDTO); final String ffnlgCode = reqDTO.getFfnlgCode();
if(mobilePageManage == null) throw BizRuntimeException.create("데이타 오류[내문서함 문서가 없습니다]"); final KtCommonDTO.KtCommonResponse cfmRes = ktGbsService.cfmToken(reqDTO);
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()
);
return ApiResponseDTO.success(mobilePageManage.getMobilePageCn()); 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.http.MediaType;
import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping; 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.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam; 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 io.swagger.v3.oas.annotations.tags.Tag;
import kr.xit.biz.common.ApiConstants; import kr.xit.biz.common.ApiConstants;
import kr.xit.biz.common.ApiConstants.SignguCode; 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.kt.KtTokenDTO;
import kr.xit.biz.ens.model.ktgbs.KtGbsDTO;
import kr.xit.biz.mbl.model.MobilePageDTO; import kr.xit.biz.mbl.model.MobilePageDTO;
import kr.xit.biz.mbl.service.IMobilePageService; import kr.xit.biz.mbl.service.IMobilePageService;
import kr.xit.core.exception.BizRuntimeException; import kr.xit.core.exception.BizRuntimeException;
import kr.xit.core.model.IApiResponse;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
/** /**
@ -85,6 +83,9 @@ public class MobilePageController {
/** /**
* <pre> * <pre>
* KT * KT
* /kt/mblPage/old - ( API )
* /kt/mblPage/canES -
* /kt/mblPage/canWB -
* - (BC-AG-SN-002) API * - (BC-AG-SN-002) API
* -> url(callback) * -> url(callback)
* -> callback url ? token=... * -> callback url ? token=...
@ -103,37 +104,56 @@ public class MobilePageController {
*/ */
@Operation(summary = "KT 모바일 데이타 요청(모바일 페이지에서 호출)", description = "KT 모바일 데이타 요청(모바일 페이지에서 호출)") @Operation(summary = "KT 모바일 데이타 요청(모바일 페이지에서 호출)", description = "KT 모바일 데이타 요청(모바일 페이지에서 호출)")
@PostMapping( @PostMapping(
value = {"/kt/dpMblPage", "/kt/meMblPage"}, value = {"/kt/mblPage/old", "/kt/mblPage/canES", "/kt/mblPage/canWN"},
produces = MediaType.APPLICATION_JSON_VALUE) 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(); final String uri = request.getRequestURI();
String mblCnts = "";
ModelAndView mav = new ModelAndView();
mav.setViewName("/notiprnt");
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 적용 안됨 //FIXME: KT mblpage 적용 안됨
final KtTokenDTO.KtTokenConfirmRequest cfmReqDTO = KtTokenDTO.KtTokenConfirmRequest.builder() mblCnts = service.findKtBcMblPage(
.signguCode(SignguCode.CHUNCHEON.getCode()) KtTokenDTO.KtTokenConfirmRequest.builder()
.signguCode("")
.ffnlgCode(ApiConstants.FFNLN_CODE) .ffnlgCode(ApiConstants.FFNLN_CODE)
.accessToken(token) .accessToken(token)
.build(); .build()
);
//FIXME: KT mblpage 적용 안됨 default:
if(uri.contains("meMblPage")){ throw BizRuntimeException.create(String.format("정상적인 요청이 아닙니다. 요청 url을 확인해 주세요.\n(요청 URL: %s)", uri));
cfmReqDTO.setSignguCode(SignguCode.CHEONAN_ES.getCode());
//cfmReqDTO.setSignguCode(SignguCode.CHEONAN_WN.getCode());
}
return service.findKtMblPage(cfmReqDTO);
} }
mav.addObject("details", mblCnts);
/** }catch (Exception e){
* <pre> mav.addObject("errCode", e.getMessage());
* XIT mav.addObject("errMsg", e.getMessage());
* - mens-web : {@code EnsInboundApiController.findXitMblPage} }
* <a href="http://localhost:8080/api/web/mbl/v1/xit/mblPage.do">xit mobile page</a> return mav;
* @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);
} }
} }

@ -31,8 +31,8 @@
AND tekmd.external_id = #{externalId} AND tekmd.external_id = #{externalId}
</select> </select>
<select id="selectKtMobilePage" resultType="kr.xit.biz.mbl.model.MobilePageDTO$MobilePageManage"> <select id="selectKtBcMobilePage" resultType="kr.xit.biz.mbl.model.MobilePageDTO$MobilePageManage">
/** ens-mbl-mysql-mapper|selectKtMobilePage-KT 모바일 페이지 콘텐트 조회|julim */ /** ens-mbl-mysql-mapper|selectKtBcMobilePage-KT BC 모바일 페이지 콘텐트 조회|julim */
SELECT tempm.sndng_detail_id SELECT tempm.sndng_detail_id
, tempm.sndng_se_code , tempm.sndng_se_code
, tempm.mobile_page_cn , tempm.mobile_page_cn
@ -41,12 +41,4 @@
ON tekbd.sndng_detail_id = tempm.sndng_detail_id ON tekbd.sndng_detail_id = tempm.sndng_detail_id
WHERE tekbd.src_key = #{srcKey} WHERE tekbd.src_key = #{srcKey}
</select> </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>
</mapper> </mapper>

@ -31,8 +31,8 @@
AND tekmd.external_id = #{externalId} AND tekmd.external_id = #{externalId}
</select> </select>
<select id="selectKtMobilePage" resultType="kr.xit.biz.mbl.model.MobilePageDTO$MobilePageManage"> <select id="selectKtBcMobilePage" resultType="kr.xit.biz.mbl.model.MobilePageDTO$MobilePageManage">
/** ens-mbl-oracle-mapper|selectKtMobilePage-KT 모바일 페이지 콘텐트 조회|julim */ /** ens-mbl-oracle-mapper|selectKtBcMobilePage-KT BC 모바일 페이지 콘텐트 조회|julim */
SELECT tempm.sndng_detail_id SELECT tempm.sndng_detail_id
, tempm.sndng_se_code , tempm.sndng_se_code
, tempm.mobile_page_cn , tempm.mobile_page_cn
@ -42,11 +42,15 @@
WHERE tekbd.src_key = #{srcKey} WHERE tekbd.src_key = #{srcKey}
</select> </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> </mapper>

Loading…
Cancel
Save