From 4cb9758c935409e3afd005d60e947d985f3d8608 Mon Sep 17 00:00:00 2001 From: limju Date: Fri, 22 Sep 2023 11:49:22 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EB=AC=B8=EC=84=9C=EC=A4=91=EA=B3=84?= =?UTF-8?q?=EC=9E=90(KT/KAKAO)=20=EC=A0=95=EB=B3=B4=20cache=20=EB=B0=98?= =?UTF-8?q?=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../biz/cmm/mapper/ICmmEnsCacheMapper.java | 2 + .../biz/cmm/service/CmmEnsCacheService.java | 38 ++++++++++++++++- .../biz/cmm/service/ICmmEnsCacheService.java | 6 ++- .../kr/xit/core/spring/config/CacheType.java | 7 ++++ .../mapper/biz/ens-cmm-cache-mysql-mapper.xml | 41 ++++++------------- .../mapper/biz/ens-nice-mysql-mapper.xml | 3 -- .../kr/xit/biz/ens/model/nice/NiceCiDTO.java | 5 --- 7 files changed, 63 insertions(+), 39 deletions(-) diff --git a/mens-api/src/main/java/kr/xit/biz/cmm/mapper/ICmmEnsCacheMapper.java b/mens-api/src/main/java/kr/xit/biz/cmm/mapper/ICmmEnsCacheMapper.java index f33e364..f9f1985 100644 --- a/mens-api/src/main/java/kr/xit/biz/cmm/mapper/ICmmEnsCacheMapper.java +++ b/mens-api/src/main/java/kr/xit/biz/cmm/mapper/ICmmEnsCacheMapper.java @@ -1,5 +1,6 @@ package kr.xit.biz.cmm.mapper; +import kr.xit.biz.ens.model.cmm.CmmEnsRlaybsnmDTO; import kr.xit.biz.ens.model.nice.NiceCiDTO.NiceCiInfo; import org.egovframe.rte.psl.dataaccess.mapper.Mapper; @@ -22,4 +23,5 @@ import org.egovframe.rte.psl.dataaccess.mapper.Mapper; @Mapper public interface ICmmEnsCacheMapper { NiceCiInfo selectNiceCiInfo(final NiceCiInfo dto); + CmmEnsRlaybsnmDTO selectEnsRlaybsnmInfo(final CmmEnsRlaybsnmDTO dto); } diff --git a/mens-api/src/main/java/kr/xit/biz/cmm/service/CmmEnsCacheService.java b/mens-api/src/main/java/kr/xit/biz/cmm/service/CmmEnsCacheService.java index 413fe38..9fd2acb 100644 --- a/mens-api/src/main/java/kr/xit/biz/cmm/service/CmmEnsCacheService.java +++ b/mens-api/src/main/java/kr/xit/biz/cmm/service/CmmEnsCacheService.java @@ -3,6 +3,7 @@ package kr.xit.biz.cmm.service; import com.github.benmanes.caffeine.cache.Cache; import com.github.benmanes.caffeine.cache.stats.CacheStats; import kr.xit.biz.cmm.mapper.ICmmEnsCacheMapper; +import kr.xit.biz.ens.model.cmm.CmmEnsRlaybsnmDTO; import kr.xit.biz.ens.model.nice.NiceCiDTO.NiceCiInfo; import kr.xit.core.spring.config.CacheKeyGenerator; import kr.xit.core.spring.config.CacheType; @@ -43,7 +44,7 @@ public class CmmEnsCacheService implements ICmmEnsCacheService { private final CacheManager cacheManager; /** - * GET Nice CI 인증 관련 정보 + * Nice CI 인증 관련 정보 cache load * @param signguCode * @param ffnlgCode * @return CrtfInfo @@ -57,11 +58,46 @@ public class CmmEnsCacheService implements ICmmEnsCacheService { .build()); } + /** + * Nice CI 인증 관련 정보 cache remove + * @param signguCode + * @param ffnlgCode + */ @Transactional(readOnly = true) @CacheEvict(cacheNames = "niceCiInfo", keyGenerator = "cacheKeyGenerator") public void removeNiceCiInfoCache(final String signguCode, final String ffnlgCode) { } + /** + * KT / KAKAO 인증 관련 정보 cache load + * @param signguCode + * @param ffnlgCode + * @return CmmEnsRlaybsnmDTO + */ + @Transactional(readOnly = true) + @Cacheable(cacheNames = "rlaybsnmInfo", keyGenerator = "cacheKeyGenerator") + public CmmEnsRlaybsnmDTO getRlaybsnmInfoCache(final String signguCode, final String ffnlgCode) { + return cmmEnsMapper.selectEnsRlaybsnmInfo( + CmmEnsRlaybsnmDTO.builder() + .signguCode(signguCode) + .ffnlgCode(ffnlgCode) + .build() + ); + } + + /** + * KT / KAKAO 인증 관련 정보 cache remove + * @param signguCode + * @param ffnlgCode + */ + @Transactional(readOnly = true) + @CacheEvict(cacheNames = "rlaybsnmInfo", keyGenerator = "cacheKeyGenerator") + public void removeRlaybsnmInfoCache(final String signguCode, final String ffnlgCode) { + } + + /** + * cache log : hit rate + */ public void logCache(){ if(log.isDebugEnabled()) { for(String cacheName : cacheManager.getCacheNames()) { diff --git a/mens-api/src/main/java/kr/xit/biz/cmm/service/ICmmEnsCacheService.java b/mens-api/src/main/java/kr/xit/biz/cmm/service/ICmmEnsCacheService.java index 90cd97b..99fb9b9 100644 --- a/mens-api/src/main/java/kr/xit/biz/cmm/service/ICmmEnsCacheService.java +++ b/mens-api/src/main/java/kr/xit/biz/cmm/service/ICmmEnsCacheService.java @@ -1,5 +1,6 @@ package kr.xit.biz.cmm.service; +import kr.xit.biz.ens.model.cmm.CmmEnsRlaybsnmDTO; import kr.xit.biz.ens.model.nice.NiceCiDTO.NiceCiInfo; /** @@ -19,9 +20,10 @@ import kr.xit.biz.ens.model.nice.NiceCiDTO.NiceCiInfo; */ public interface ICmmEnsCacheService { NiceCiInfo getNiceCiInfoCache(final String signguCode, final String ffnlgCode); - - void removeNiceCiInfoCache(final String signguCode, final String ffnlgCode); + CmmEnsRlaybsnmDTO getRlaybsnmInfoCache(final String signguCode, final String ffnlgCode); + void removeRlaybsnmInfoCache(final String signguCode, final String ffnlgCode); + void logCache(); } diff --git a/mens-api/src/main/java/kr/xit/core/spring/config/CacheType.java b/mens-api/src/main/java/kr/xit/core/spring/config/CacheType.java index 77b81cb..4844315 100644 --- a/mens-api/src/main/java/kr/xit/core/spring/config/CacheType.java +++ b/mens-api/src/main/java/kr/xit/core/spring/config/CacheType.java @@ -26,7 +26,14 @@ import lombok.Getter; @AllArgsConstructor public enum CacheType { + /** + * NICE CI 정보 + */ NICE_CRTF("niceCiInfo", 60 * 60 * 24, 10), + /** + * KT / KAKAO 정보 + */ + RLAY_BSNM("rlaybsnmInfo", 60 * 60 * 24, 10), ; /** diff --git a/mens-api/src/main/resources/egovframework/mapper/biz/ens-cmm-cache-mysql-mapper.xml b/mens-api/src/main/resources/egovframework/mapper/biz/ens-cmm-cache-mysql-mapper.xml index 6fa976a..f8db7bf 100644 --- a/mens-api/src/main/resources/egovframework/mapper/biz/ens-cmm-cache-mysql-mapper.xml +++ b/mens-api/src/main/resources/egovframework/mapper/biz/ens-cmm-cache-mysql-mapper.xml @@ -27,44 +27,29 @@ bef_symkey_valid_dtim, /* 이전 대칭키 만료일시 */ bef_symkey_key, /* 이전 대칭키 - key */ bef_symkey_iv, /* 이전 대칭키 - iv */ - bef_symkey_hmac_key, /* 이전 대칭키 - hmac_key */ - timestampdiff(DAY, now(), valid_dtim) AS remainingDays /* 잔여일수-공용키 */ + bef_symkey_hmac_key /* 이전 대칭키 - hmac_key */ FROM tb_cmm_nice_instn_crtf_info WHERE signgu_code = #{signguCode} AND ffnlg_code = #{ffnlgCode} - -- AND client_id = #{clientId} - /** ens-cmm-cache-mysql-mapper|selectEnsRlaybsnmInfo-중계사업관리자정보조회|julim */ SELECT signgu_code, /* 시군구코드 */ ffnlg_code, /* 과태료코드 */ - client_id, /* nice client id */ - client_secret, /* app security code */ - product_id, /* 상품 코드 */ - access_token, /* access token */ - expires_in, /* access token 만료일시(초)*/ - token_type, /* token type */ - scope, /* token scope */ - site_code, /* 공개키 사이트 코드 */ - key_version, /* 공개키 버전 */ - public_key, /* 공개키 */ - valid_dtim, /* 공개키 만료일시 */ - cur_symkey_version, /* 현재 대칭키 버전 */ - cur_symkey_valid_dtim, /* 현재 대칭키 만료일시 */ - cur_symkey_key, /* 현재 대칭키 - key */ - cur_symkey_iv, /* 현재 대칭키 - iv */ - cur_symkey_hmac_key, /* 현재 대칭키 - hmac_key */ - bef_symkey_version, /* 이전 대칭키 버전 */ - bef_symkey_valid_dtim, /* 이전 대칭키 만료일시 */ - bef_symkey_key, /* 이전 대칭키 - key */ - bef_symkey_iv, /* 이전 대칭키 - iv */ - bef_symkey_hmac_key, /* 이전 대칭키 - hmac_key */ - timestampdiff(DAY, now(), valid_dtim) AS remainingDays /* 잔여일수-공용키 */ - FROM tb_cmm_nice_instn_crtf_info + signgu_nm, /* 시군구 명 */ + ffnlg_nm, /* 과태료 명 */ + kakao_access_token, /* 카카오 access token */ + kakao_contract_uuid, /* 카카오 contract uuid */ + kt_access_token, /* KT access token */ + kt_company_cd, /* KT company code */ + sender_nm, /* 발송인 명 */ + sender_zip_no, /* 발송인 우편 번호 */ + sender_addr, /* 발송인 주소 */ + sender_detail_addr /* 발송인 상세 주소 */ + FROM tb_ens_rlaybsnm_manage WHERE signgu_code = #{signguCode} AND ffnlg_code = #{ffnlgCode} - -- AND client_id = #{clientId} diff --git a/mens-api/src/main/resources/egovframework/mapper/biz/ens-nice-mysql-mapper.xml b/mens-api/src/main/resources/egovframework/mapper/biz/ens-nice-mysql-mapper.xml index fdcce14..7859612 100644 --- a/mens-api/src/main/resources/egovframework/mapper/biz/ens-nice-mysql-mapper.xml +++ b/mens-api/src/main/resources/egovframework/mapper/biz/ens-nice-mysql-mapper.xml @@ -14,7 +14,6 @@ updusr = 'api-biz' WHERE signgu_code = #{signguCode} AND ffnlg_code = #{ffnlgCode} - -- AND client_id = #{clientId} @@ -28,7 +27,6 @@ updusr = 'api-biz' WHERE signgu_code = #{signguCode} AND ffnlg_code = #{ffnlgCode} - -- AND client_id = #{clientId} @@ -48,7 +46,6 @@ updusr = 'api-biz' WHERE signgu_code = #{signguCode} AND ffnlg_code = #{ffnlgCode} - -- AND client_id = #{clientId} 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 89ab59d..5f93076 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 @@ -1033,10 +1033,5 @@ public class NiceCiDTO { * 이전 대칭키 hmac_key */ private String befSymkeyHmacKey; - - /** - * 공개키 잔여일수 - */ - private int remainingDays; } }