feat: ens 모바일 페이지 API 반영

dev
gitea-관리자 1 year ago
parent 39541f7af4
commit 482f6922ed

@ -1,10 +0,0 @@
/**
* kakao ENS business packages
* <p>
* : kakao
* </p>
* @since 1.0
* @author limju
* @version 1.0
*/
package kr.xit.biz.kakao;

@ -1,68 +0,0 @@
package kr.xit.biz.kakao.service;
import kr.xit.biz.ens.model.kakao.KkopayDocDTO;
import kr.xit.biz.ens.model.kakao.KkopayDocDTO.OneTimeToken;
import kr.xit.biz.kakao.mapper.IKkoMyDocMapper;
import kr.xit.biz.kakao.model.KkoMyDocDTO.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.support.utils.Checks;
import kr.xit.ens.kakao.service.IKkopayEltrcDocService;
import lombok.RequiredArgsConstructor;
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
import org.springframework.stereotype.Service;
/**
* <pre>
* description : API Service
*
* packageName : kr.xit.biz.kakao.service
* fileName : KkoMyDocService
* author : limju
* date : 2023-08-31
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-08-31 limju
*
* </pre>
*/
@RequiredArgsConstructor
@Service
public class KkoMyDocService extends EgovAbstractServiceImpl implements IKkoMyDocService {
private final IKkoMyDocMapper mapper;
private final IKkopayEltrcDocService service;
/**
* <pre>
* </h3>
* - : (bulks-) document_binder_uuid
* - redirect url
* ->
* -> > >
*
*
* 1. (redirect url /
* 2.
*
* @param reqDTO KkopayDocDTO.OneTimeToken
* </pre>
*/
@Override
public IApiResponse findKkoMyDocReadyAndMblPage(OneTimeToken reqDTO) {
if (Checks.isEmpty(reqDTO.getToken()) || Checks.isEmpty(reqDTO.getDocument_binder_uuid()) || Checks.isEmpty(reqDTO.getExternal_document_uuid()))
throw BizRuntimeException.create(String.valueOf(ErrorCode.BAD_REQUEST.getHttpStatus().value()), "정상적인 요청이 아닙니다. 재인증 후 시도하시기 바랍니다.");
// document_binder_uuid와 external_document_uuid로 데이타 검증
final MobilePageManage mobilePageManage = mapper.selectMobilePage(reqDTO);
if(mobilePageManage == null) throw BizRuntimeException.create("데이타 오류[내문서함 문서가 없습니다]");
final ApiResponseDTO<KkopayDocDTO.ValidTokenResponse> res = service.findMyDocReadyAndMblPage(reqDTO);
if(!res.isSuccess()){
return res;
}
return ApiResponseDTO.success(mobilePageManage.getMobilePageCn());
}
}

@ -1,45 +0,0 @@
package kr.xit.biz.kakao.web;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import kr.xit.biz.ens.model.kakao.KkopayDocDTO.OneTimeToken;
import kr.xit.biz.kakao.service.IKkoMyDocService;
import kr.xit.core.model.IApiResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
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.RestController;
/**
* <pre>
* description : API Controller
*
* packageName : kr.xit.biz.kakao.web
* fileName : KkoMyDocController
* author : limju
* date : 2023-08-31
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-08-31 limju
*
* </pre>
*/
@Tag(name = "KkoMyDocController", description = "카카오페이 전자문서 API Controller")
@RequiredArgsConstructor
@RestController
@RequestMapping(value = "/api/biz/kakao/v1")
public class KkoMyDocController {
private final IKkoMyDocService service;
@Operation(summary = "모바일 데이타 요청(모바일 페이지에서 호출)", description = "모바일 데이타 요청(모바일 페이지에서 호출)")
@PostMapping(value = "/mblData", produces = MediaType.APPLICATION_JSON_VALUE)
public IApiResponse findKkoMyDocReadyAndMblData(
@RequestBody final OneTimeToken reqDTO
) {
return service.findKkoMyDocReadyAndMblPage(reqDTO);
}
}

@ -165,11 +165,9 @@ public class BizKtMmsService extends EgovAbstractServiceImpl implements IBizKtMm
//TODO:: srckey로 컨텐츠 조회후 결과 return
return null;
}
//List<ErrorMsg> errorMsgs = readRes.getErrors();
//String.join(",", Arrays.stream(errorMsgs).toArray())
throw BizRuntimeException.create("~~~~열람확인 오류~~~~");
throw BizRuntimeException.create(readRes.toStringErrorMsg());
}
throw BizRuntimeException.create("~~~~토큰인증확인 오류~~~~");
throw BizRuntimeException.create(cfmRes.toStringErrorMsg());
}
@Override

@ -1,15 +1,15 @@
package kr.xit.biz.kakao.mapper;
package kr.xit.biz.mbl.mapper;
import kr.xit.biz.ens.model.kakao.KkopayDocDTO.OneTimeToken;
import kr.xit.biz.kakao.model.KkoMyDocDTO.MobilePageManage;
import kr.xit.biz.mbl.model.MobilePageDTO.MobilePageManage;
import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
/**
* <pre>
* description : API mapper
* description : API mapper
*
* packageName : kr.xit.biz.kakao.mapper
* fileName : IKkoMyDocMapper
* packageName : kr.xit.biz.mbl.mapper
* fileName : IMobilePageMapper
* author : limju
* date : 2023-08-31
* ======================================================================
@ -20,6 +20,7 @@ import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
* </pre>
*/
@Mapper
public interface IKkoMyDocMapper {
MobilePageManage selectMobilePage(final OneTimeToken dto);
public interface IMobilePageMapper {
MobilePageManage selectKkoMobilePage(final OneTimeToken dto);
<T> MobilePageManage selectKtMobilePage(final T t);
}

@ -1,4 +1,4 @@
package kr.xit.biz.kakao.model;
package kr.xit.biz.mbl.model;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
@ -12,10 +12,10 @@ import lombok.NoArgsConstructor;
/**
* <pre>
* description : DTO
* description : API DTO
*
* packageName : kr.xit.biz.kakao.model
* fileName : KkoMyDocDTO
* packageName : kr.xit.biz.mbl.model
* fileName : MobilePageDTO
* author : limju
* date : 2023-08-31
* ======================================================================
@ -25,7 +25,7 @@ import lombok.NoArgsConstructor;
*
* </pre>
*/
public class KkoMyDocDTO {
public class MobilePageDTO {
@Data
@NoArgsConstructor

@ -1,14 +1,16 @@
package kr.xit.biz.kakao.service;
package kr.xit.biz.mbl.service;
import kr.xit.biz.ens.model.kakao.KkopayDocDTO.OneTimeToken;
import kr.xit.biz.ens.model.kt.KtTokenDTO.KtTokenConfirmRequest;
import kr.xit.biz.mbl.model.MobilePageDTO.MobilePageManage;
import kr.xit.core.model.IApiResponse;
/**
* <pre>
* description : API Service Interface
* description : API Service Interface
*
* packageName : kr.xit.biz.kakao.service
* fileName : IKkoMyDocService
* packageName : kr.xit.biz.mbl.service
* fileName : IMobilePageService
* author : limju
* date : 2023-08-31
* ======================================================================
@ -18,7 +20,9 @@ import kr.xit.core.model.IApiResponse;
*
* </pre>
*/
public interface IKkoMyDocService {
public interface IMobilePageService {
IApiResponse findKkoMyDocReadyAndMblPage(OneTimeToken reqDTO);
MobilePageManage findKtMblPage(final KtTokenConfirmRequest reqDTO);
}

@ -0,0 +1,117 @@
package kr.xit.biz.mbl.service;
import kr.xit.biz.ens.model.kakao.KkopayDocDTO;
import kr.xit.biz.ens.model.kt.KtCommonDTO.KtCommonResponse;
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.mbl.mapper.IMobilePageMapper;
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.support.utils.Checks;
import kr.xit.ens.kakao.service.IKkopayEltrcDocService;
import kr.xit.ens.kt.service.IKtMmsService;
import lombok.RequiredArgsConstructor;
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
import org.springframework.stereotype.Service;
/**
* <pre>
* description : API Service
*
* packageName : kr.xit.biz.mbl.service
* fileName : MobilePageService
* author : limju
* date : 2023-08-31
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-08-31 limju
*
* </pre>
*/
@RequiredArgsConstructor
@Service
public class MobilePageService extends EgovAbstractServiceImpl implements IMobilePageService {
private final IMobilePageMapper mapper;
private final IKkopayEltrcDocService kkoService;
private final IKtMmsService ktMmsService;
/**
* <pre>
* </h3>
* - : (bulks-) document_binder_uuid
* - redirect url
* ->
* -> > >
*
*
* 1. (redirect url /
* 2.
*
* @param reqDTO KkopayDocDTO.OneTimeToken
* </pre>
*/
@Override
public IApiResponse findKkoMyDocReadyAndMblPage(KkopayDocDTO.OneTimeToken reqDTO) {
if (Checks.isEmpty(reqDTO.getToken()) || Checks.isEmpty(reqDTO.getDocument_binder_uuid()) || Checks.isEmpty(reqDTO.getExternal_document_uuid()))
throw BizRuntimeException.create(String.valueOf(ErrorCode.BAD_REQUEST.getHttpStatus().value()), "정상적인 요청이 아닙니다. 재인증 후 시도하시기 바랍니다.");
// document_binder_uuid와 external_document_uuid로 데이타 검증
final MobilePageManage mobilePageManage = mapper.selectKkoMobilePage(reqDTO);
if(mobilePageManage == null) throw BizRuntimeException.create("데이타 오류[내문서함 문서가 없습니다]");
final ApiResponseDTO<KkopayDocDTO.ValidTokenResponse> res = kkoService.findMyDocReadyAndMblPage(reqDTO);
if(!res.isSuccess()){
return res;
}
return ApiResponseDTO.success(mobilePageManage.getMobilePageCn());
}
/**
* <pre>
* KT
* - (BC-AG-SN-002) API
* -> url(callback)
* -> callback url ? token=...
* 1. (BC-AG-SN-008) API call
* 2. (BC-AG-SN-009) API call
* -> srcKey
* 3. kt
* -> return
* @param reqDTO KtTokenConfirmRequest
* @return
* </pre>
*/
@Override
public MobilePageManage findKtMblPage(final KtTokenDTO.KtTokenConfirmRequest reqDTO) {
if (Checks.isEmpty(reqDTO.getAccessToken()))
throw BizRuntimeException.create(String.valueOf(ErrorCode.BAD_REQUEST.getHttpStatus().value()), "정상적인 요청이 아닙니다. 재인증 후 시도하시기 바랍니다.");
final String signguCode = reqDTO.getSignguCode();
final String ffnlgCode = reqDTO.getFfnlgCode();
final KtTokenConfirmResponse cfmRes = ktMmsService.cfmToken(reqDTO);
if(cfmRes.getResultCd().equals("00")){
KtCommonResponse readRes = ktMmsService.readToken(
KtTokenReadRequest.builder()
.signguCode(signguCode)
.ffnlgCode(ffnlgCode)
.accessToken(reqDTO.getAccessToken())
.build()
);
if(readRes.getResultCd().equals("00")){
String srcKey = cfmRes.getSrcKey();
//TODO:: srckey로 컨텐츠 조회후 결과 return
return mapper.selectKtMobilePage(srcKey);
}
throw BizRuntimeException.create(readRes.getResultCd(), readRes.toStringErrorMsg());
}
throw BizRuntimeException.create(cfmRes.getResultCd(), cfmRes.toStringErrorMsg());
}
}

@ -0,0 +1,115 @@
package kr.xit.biz.mbl.web;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import javax.servlet.http.HttpServletRequest;
import kr.xit.biz.common.ApiConstants;
import kr.xit.biz.common.ApiConstants.SignguCode;
import kr.xit.biz.ens.model.kakao.KkopayDocDTO;
import kr.xit.biz.ens.model.kt.KtTokenDTO;
import kr.xit.biz.mbl.service.IMobilePageService;
import kr.xit.core.model.ApiResponseDTO;
import kr.xit.core.model.IApiResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
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;
import org.springframework.web.bind.annotation.RestController;
/**
* <pre>
* description : API Controller
*
* packageName : kr.xit.biz.mbl.web
* fileName : MobilePageController
* author : limju
* date : 2023-08-31
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-08-31 limju
*
* </pre>
*/
@Tag(name = "MobilePageController", description = "전자문서 중개자 모바일 페이지 API Controller")
@RequiredArgsConstructor
@RestController
@RequestMapping(value = "/api/biz/mbl/v1")
public class MobilePageController {
private final IMobilePageService service;
/**
*
* @param reqDTO
* @return IApiResponse String return
*/
@Operation(summary = "카카오 모바일 데이타 요청(모바일 페이지에서 호출)", description = "카카오 모바일 데이타 요청(모바일 페이지에서 호출)")
@PostMapping(value = "/kko/mblPage", produces = MediaType.APPLICATION_JSON_VALUE)
public IApiResponse findKkoMyDocReadyAndMblData(@RequestBody final KkopayDocDTO.OneTimeToken reqDTO) {
return service.findKkoMyDocReadyAndMblPage(reqDTO);
}
/**
* <pre>
* KT
* - (BC-AG-SN-002) API
* -> url(callback)
* -> callback url ? token=...
* - (BC-AG-SN-008) API call
* - (BC-AG-SN-009) API call
* @param token OTT token
* @param request HttpServletRequest
* @return IApiResponse String return
* </pre>
*/
@Operation(summary = "KT 모바일 데이타 요청(모바일 페이지에서 호출)", description = "KT 모바일 데이타 요청(모바일 페이지에서 호출)")
// @PostMapping(
// value = {"/kt/dp_mblPage", "/kt/me_mblPage"},
// produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(
method = {RequestMethod.GET, RequestMethod.POST},
value = {"/kt/dpMblPage", "/kt/meMblPage"},
produces = MediaType.APPLICATION_JSON_VALUE)
public IApiResponse cfmTokenDp(@RequestParam final String token, final HttpServletRequest request) {
final String uri = request.getRequestURI();
final KtTokenDTO.KtTokenConfirmRequest cfmReqDTO = KtTokenDTO.KtTokenConfirmRequest.builder()
.signguCode(SignguCode.TRAFFIC.getCode())
.ffnlgCode(ApiConstants.FFNLN_CODE)
.accessToken(token)
.build();
if(uri.contains("me_mblPage")){
cfmReqDTO.setSignguCode(SignguCode.FUNERAL.getCode());
}
return ApiResponseDTO.success(service.findKtMblPage(cfmReqDTO));
}
// @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.findKtMblPage(
// 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.findKtMblPage(
// KtTokenConfirmRequest.builder()
// .signguCode(SignguCode.FUNERAL.getCode())
// .ffnlgCode(ApiConstants.FFNLN_CODE)
// .accessToken(token)
// .build()
// );
// return ApiResponseDTO.success(mblData);
// }
}

@ -165,8 +165,8 @@ public class TraceLoggerAspect {
*/
protected void traceLogging(final String params, final HttpServletRequest request) {
if(request != null) {
String uri = request.getRequestURI().toString();
if(Arrays.asList(excludes).stream().anyMatch(regx -> uri.matches(regx))) return;
String uri = request.getRequestURI();
if(Arrays.stream(excludes).anyMatch(uri::matches)) return;
MDC.put(REQUEST_TRACE_ID,
StringUtils.defaultString(MDC.get("request_trace_batch_id"), UUID.randomUUID().toString().replaceAll("/-/g", "")));

@ -53,12 +53,12 @@ contract:
# 토큰인증확인조회 : BC-AG-SN-008
cfm-token: /api/message/token
# 토큰열람확인결과전송 : BC-AG-SN-009
read-token: /api/message/token
read-token: /api/message/read
# 사전/본 문자 발송/수신 결과 전송 : 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
me-callback-url: http://211.119.124.7:8081/api/biz/kt/v1/cfmTokenMe
dp-callback-url: http://211.119.124.7:8081/api/biz/mbl/v1/kt/dpMblPage
me-callback-url: http://211.119.124.7:8081/api/biz/mbl/v1/kt/meMblPage
# 사전문자수신등록 : BC-AG-SN-001
before-send: /api/message/before/send

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="kr.xit.biz.mbl.mapper.IMobilePageMapper">
<select id="selectKkoMobilePage" resultType="kr.xit.biz.mbl.model.MobilePageDTO$MobilePageManage">
/** ens-mbl-mysql-mapper|selectKkoMobilePage-카카오 모바일 페이지 콘텐트 조회|julim */
SELECT tempm.sndng_detail_id
, tempm.sndng_se_code
, tempm.mobile_page_cn
FROM tb_ens_kakao_my_doc tekmd
JOIN tb_ens_mobile_page_manage tempm
ON tekmd.sndng_detail_id = tempm.sndng_detail_id
WHERE tekmd.unity_sndng_detail_id = #{external_document_uuid}
AND tekmd.document_binder_uuid = #{document_binder_uuid}
</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.unity_sndng_detail_id = #{srcKey}
</select>
</mapper>

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="kr.xit.biz.kakao.mapper.IKkoMyDocMapper">
<select id="selectMobilePage" resultType="kr.xit.biz.kakao.model.KkoMyDocDTO$MobilePageManage">
/** ens-mysql-mapper|selectMobilePage-모바일페이지콘텐트조회|julim */
SELECT tempm.sndng_detail_id
, tempm.sndng_se_code
, tempm.mobile_page_cn
FROM tb_ens_kakao_my_doc tekmd
JOIN tb_ens_mobile_page_manage tempm
ON tekmd.sndng_detail_id = tempm.sndng_detail_id
WHERE tekmd.unity_sndng_detail_id = #{external_document_uuid}
AND tekmd.document_binder_uuid = #{document_binder_uuid}
</select>
</mapper>

@ -180,7 +180,7 @@ public class ApiConstants {
*/
TRAFFIC("88328"),
/**
* : NICE CI
* : NICE CI
*/
FUNERAL("88316"),
;

@ -7,6 +7,7 @@ import com.fasterxml.jackson.databind.annotation.JsonNaming;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
import java.util.List;
import java.util.stream.Collectors;
import javax.validation.Valid;
import javax.validation.constraints.Size;
import kr.xit.core.model.IApiResponse;
@ -103,6 +104,11 @@ public class KtCommonDTO {
@Schema(requiredMode = RequiredMode.AUTO)
@Valid
private List<ErrorMsg> errors;
public String toStringErrorMsg(){
return this.errors.stream()
.map(ErrorMsg::getErrorMsg)
.collect(Collectors.joining(","));
}
}
@Schema(name = "ErrorMsg", description = "KT 응답 공통 errors DTO")
@ -123,5 +129,4 @@ public class KtCommonDTO {
@Size(max = 255)
private String errorMsg;
}
}

Loading…
Cancel
Save