From 78fe7c5172e1639602f9b2739c60ee03dbc2e078 Mon Sep 17 00:00:00 2001 From: limju Date: Thu, 16 Nov 2023 14:30:23 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20KT=20=ED=86=A0=ED=81=B0=EC=A0=95?= =?UTF-8?q?=EB=B3=B4=20=EC=98=A4=EB=A5=98=EC=8B=9C=20=EB=B0=9C=EC=83=9D?= =?UTF-8?q?=ED=95=98=EB=8A=94=20=EC=97=90=EB=9F=AC=20fix=20=20=20=20=20=20?= =?UTF-8?q?API=20=EB=A1=9C=EA=B9=85=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../biz/cmm/service/CmmEnsCacheService.java | 4 +-- .../kr/xit/biz/kt/web/BizKtMmsController.java | 2 +- .../kr/xit/core/aop/TraceLoggerAspect.java | 30 ++++++++++--------- ...gingMapper.java => IApiLoggingMapper.java} | 12 ++++---- ...ingService.java => ApiLoggingService.java} | 28 ++++++++--------- ...ngService.java => IApiLoggingService.java} | 10 +++---- .../xit/core/spring/util/ApiSpringUtils.java | 6 ++-- .../main/java/kr/xit/ens/cmm/CmmEnsUtils.java | 13 ++++---- .../kr/xit/ens/kt/service/KtMmsService.java | 13 +++++++- .../kr/xit/ens/kt/web/KtMmsController.java | 4 +-- .../mapper/biz/ens-cmm-cache-mysql-mapper.xml | 5 +++- .../mapper/core/logging-mysql-mapper.xml | 12 ++++---- .../biz/ens/service/EnsBatchSendService.java | 8 +++-- .../mapper/core/batch-cmm-mysql-mapper.xml | 2 +- 14 files changed, 82 insertions(+), 67 deletions(-) rename mens-api/src/main/java/kr/xit/core/biz/mapper/{ILoggingMapper.java => IApiLoggingMapper.java} (67%) rename mens-api/src/main/java/kr/xit/core/biz/service/{LoggingService.java => ApiLoggingService.java} (60%) rename mens-api/src/main/java/kr/xit/core/biz/service/{ILoggingService.java => IApiLoggingService.java} (70%) 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 652ee79..8bac251 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 @@ -71,7 +71,7 @@ public class CmmEnsCacheService implements ICmmEnsCacheService { * @return CmmEnsRlaybsnmDTO */ @Transactional(readOnly = true) - //@Cacheable(cacheNames = "rlaybsnmInfo", keyGenerator = "simpleKeyGenerator") + @Cacheable(cacheNames = "rlaybsnmInfo", keyGenerator = "simpleKeyGenerator") public CmmEnsRlaybsnmDTO getRlaybsnmInfoCache(final CmmEnsRequestDTO dto) { return cmmEnsMapper.selectEnsRlaybsnmInfo(dto); } @@ -83,7 +83,7 @@ public class CmmEnsCacheService implements ICmmEnsCacheService { @Transactional(readOnly = true) @CacheEvict(cacheNames = "rlaybsnmInfo", keyGenerator = "simpleKeyGenerator") public void removeRlaybsnmInfoCache(final CmmEnsRequestDTO dto) { - log.info("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&{} cache remove&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", dto); + log.info("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&{} cache remove &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", dto); } /** 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 d07394f..07d47be 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 @@ -66,7 +66,7 @@ public class BizKtMmsController { value = PARAM2) }) }) - @Operation(summary = "기관용 토큰 발급 요청", description = "기관용 토큰 발급 요청") + @Operation(deprecated = true, summary = "기관용 토큰 발급 요청", description = "기관용 토큰 발급 요청") @PostMapping(value = "/requestToken", produces = MediaType.APPLICATION_JSON_VALUE) public IApiResponse requestToken(@RequestBody final KtMnsRequest paramDTO) { return ApiResponseDTO.success(service.requestToken(paramDTO)); diff --git a/mens-api/src/main/java/kr/xit/core/aop/TraceLoggerAspect.java b/mens-api/src/main/java/kr/xit/core/aop/TraceLoggerAspect.java index d2e5198..56e094d 100644 --- a/mens-api/src/main/java/kr/xit/core/aop/TraceLoggerAspect.java +++ b/mens-api/src/main/java/kr/xit/core/aop/TraceLoggerAspect.java @@ -10,7 +10,7 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; import javax.servlet.http.HttpServletRequest; import kr.xit.core.biz.model.LoggingDTO; -import kr.xit.core.biz.service.ILoggingService; +import kr.xit.core.biz.service.IApiLoggingService; import kr.xit.core.exception.BizRuntimeException; import kr.xit.core.model.ApiResponseDTO; import kr.xit.core.spring.util.error.ErrorParse; @@ -85,12 +85,12 @@ public class TraceLoggerAspect { @Value("#{'${app.log.mdc.exclude-patterns}'.split(',')}") private String[] excludes; - private final ILoggingService loggingService; + private final IApiLoggingService apiLoggingService; private final SlackWebhookPush slackWebhookPush; private static final String REQUEST_TRACE_ID = "request_trace_id"; - public TraceLoggerAspect(@Lazy ILoggingService loggingService, SlackWebhookPush slackWebhookPush) { - this.loggingService = loggingService; + public TraceLoggerAspect(@Lazy IApiLoggingService apiLoggingService, SlackWebhookPush slackWebhookPush) { + this.apiLoggingService = apiLoggingService; this.slackWebhookPush = slackWebhookPush; } @@ -122,7 +122,7 @@ public class TraceLoggerAspect { ServletRequestAttributes attributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes(); HttpServletRequest request = attributes != null? attributes.getRequest(): null; - traceLogging(JsonUtils.toObjByObj(pjp.getArgs()[0], JSONObject.class), request); + traceApiLogging(JsonUtils.toObjByObj(pjp.getArgs()[0], JSONObject.class), request); Object result = pjp.proceed(); //noinspection rawtypes @@ -131,9 +131,9 @@ public class TraceLoggerAspect { while(true) { if (future.isDone()) break; } - traceLoggingResult(future.get()); + traceApiLoggingResult(future.get()); }else{ - traceLoggingResult(result); + traceApiLoggingResult(result); } return result; } @@ -151,7 +151,7 @@ public class TraceLoggerAspect { @AfterThrowing(value = "errorPointCut()", throwing="error") public void afterThrowingProceed(final JoinPoint jp, final Throwable error) { - traceLoggingError(jp, error); + traceApiLoggingError(jp, error); } /** @@ -159,7 +159,7 @@ public class TraceLoggerAspect { * @param json JSONObject * @param request HttpServletRequest */ - protected void traceLogging(final JSONObject json, final HttpServletRequest request) { + protected void traceApiLogging(final JSONObject json, final HttpServletRequest request) { String uri = ""; if(request != null) { uri = request.getRequestURI(); @@ -197,11 +197,11 @@ log.info("@@@@@@@@@@@@@@@@@로깅 start : [\n{}\n]",MDC.getCopyOfContextMap()); .accessToken("") .sessionId(MDC.getCopyOfContextMap().get("sessionId")) .build(); - loggingService.saveLogging(loggingDTO); + apiLoggingService.saveApiLogging(loggingDTO); } - protected void traceLoggingResult(final Object result) { + protected void traceApiLoggingResult(final Object result) { String success = "true"; //FIXME: slack webhook log push if(result instanceof ApiResponseDTO apiResponseDTO){ @@ -237,7 +237,7 @@ log.info("@@@@@@@@@@@@@@@@@로깅 start : [\n{}\n]",MDC.getCopyOfContextMap()); .message(HttpStatus.OK.name()) .build(); //} - loggingService.modifyLogging(reqDTO); + apiLoggingService.modifyApiLogging(reqDTO); //loggingService.saveLogging(reqDTO); log.info("@@@@@@@@@@@@@@로깅 end[\n{}\n]", MDC.getCopyOfContextMap()); @@ -265,13 +265,14 @@ log.info("@@@@@@@@@@@@@@@@@로깅 start : [\n{}\n]",MDC.getCopyOfContextMap()); } } - protected void traceLoggingError(final JoinPoint jp, final Throwable e) { + protected void traceApiLoggingError(final JoinPoint jp, final Throwable e) { log.info("MDC request_trace_id :: {}", MDC.get(REQUEST_TRACE_ID)); if(Checks.isEmpty(MDC.get(REQUEST_TRACE_ID))) return; + @SuppressWarnings("rawtypes") ApiResponseDTO dto = ErrorParse.extractError(e); - loggingService.modifyLogging( + apiLoggingService.modifyApiLogging( LoggingDTO .builder() .requestId(MDC.get(REQUEST_TRACE_ID)) @@ -378,6 +379,7 @@ log.info("@@@@@@@@@@@@@@@@@로깅 start : [\n{}\n]",MDC.getCopyOfContextMap()); PPLUS("POST-PLUS", "Post Plus", "/pplus/"), NICE("NICE", "NICE CI", "/nice/"), EPOST("EPOST", "E-POST", "/ag/"), + SISUL("SISUL", "시설공단", "/sisul/"), BATCH("BATCH", "미정의", "/미정의/"), ; diff --git a/mens-api/src/main/java/kr/xit/core/biz/mapper/ILoggingMapper.java b/mens-api/src/main/java/kr/xit/core/biz/mapper/IApiLoggingMapper.java similarity index 67% rename from mens-api/src/main/java/kr/xit/core/biz/mapper/ILoggingMapper.java rename to mens-api/src/main/java/kr/xit/core/biz/mapper/IApiLoggingMapper.java index a496161..47b8100 100644 --- a/mens-api/src/main/java/kr/xit/core/biz/mapper/ILoggingMapper.java +++ b/mens-api/src/main/java/kr/xit/core/biz/mapper/IApiLoggingMapper.java @@ -11,7 +11,7 @@ import kr.xit.core.biz.model.LoggingDTO; * description : API db logging * * packageName : kr.xit.core.biz.mapper - * fileName : ILoggingMapper + * fileName : IApiLoggingMapper * author : limju * date : 2023-05-11 * ====================================================================== @@ -22,11 +22,11 @@ import kr.xit.core.biz.model.LoggingDTO; * */ @Mapper -public interface ILoggingMapper { +public interface IApiLoggingMapper { - List selectLogging(final LoggingDTO reqDTO); - LoggingDTO selectLogging(); + List selectApiLogging(final LoggingDTO reqDTO); + LoggingDTO selectApiLogging(); - void saveLogging(final LoggingDTO reqDTO); - void updateLogging(final LoggingDTO reqDTO); + void saveApiLogging(final LoggingDTO reqDTO); + void updateApiLogging(final LoggingDTO reqDTO); } diff --git a/mens-api/src/main/java/kr/xit/core/biz/service/LoggingService.java b/mens-api/src/main/java/kr/xit/core/biz/service/ApiLoggingService.java similarity index 60% rename from mens-api/src/main/java/kr/xit/core/biz/service/LoggingService.java rename to mens-api/src/main/java/kr/xit/core/biz/service/ApiLoggingService.java index 34e17c9..def5a06 100644 --- a/mens-api/src/main/java/kr/xit/core/biz/service/LoggingService.java +++ b/mens-api/src/main/java/kr/xit/core/biz/service/ApiLoggingService.java @@ -1,8 +1,9 @@ package kr.xit.core.biz.service; import java.util.List; -import kr.xit.core.biz.mapper.ILoggingMapper; +import kr.xit.core.biz.mapper.IApiLoggingMapper; import kr.xit.core.biz.model.LoggingDTO; +import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; import org.springframework.stereotype.Service; @@ -26,33 +27,30 @@ import org.springframework.transaction.annotation.Transactional; */ @Slf4j +@RequiredArgsConstructor @Service -public class LoggingService extends EgovAbstractServiceImpl implements ILoggingService{ - private final ILoggingMapper mapper; - - public LoggingService(ILoggingMapper mapper) { - this.mapper = mapper; - } +public class ApiLoggingService extends EgovAbstractServiceImpl implements IApiLoggingService { + private final IApiLoggingMapper mapper; @Transactional(propagation = Propagation.REQUIRES_NEW) @Override - public void saveLogging(final LoggingDTO reqDTO){ - mapper.saveLogging(reqDTO); + public void saveApiLogging(final LoggingDTO reqDTO){ + mapper.saveApiLogging(reqDTO); } @Transactional(propagation = Propagation.REQUIRES_NEW) @Override - public void modifyLogging(final LoggingDTO reqDTO){ - mapper.updateLogging(reqDTO); + public void modifyApiLogging(final LoggingDTO reqDTO){ + mapper.updateApiLogging(reqDTO); } @Override - public List findLogging(final LoggingDTO reqDTO) { - return mapper.selectLogging(reqDTO); + public List findApiLogging(final LoggingDTO reqDTO) { + return mapper.selectApiLogging(reqDTO); } @Override - public LoggingDTO findLogging() { - return mapper.selectLogging(); + public LoggingDTO findApiLogging() { + return mapper.selectApiLogging(); } } diff --git a/mens-api/src/main/java/kr/xit/core/biz/service/ILoggingService.java b/mens-api/src/main/java/kr/xit/core/biz/service/IApiLoggingService.java similarity index 70% rename from mens-api/src/main/java/kr/xit/core/biz/service/ILoggingService.java rename to mens-api/src/main/java/kr/xit/core/biz/service/IApiLoggingService.java index 008f05d..a57a7da 100644 --- a/mens-api/src/main/java/kr/xit/core/biz/service/ILoggingService.java +++ b/mens-api/src/main/java/kr/xit/core/biz/service/IApiLoggingService.java @@ -19,9 +19,9 @@ import kr.xit.core.biz.model.LoggingDTO; * * */ -public interface ILoggingService { - List findLogging(LoggingDTO reqDTO); - LoggingDTO findLogging(); - void saveLogging(LoggingDTO reqDTO); - void modifyLogging(LoggingDTO reqDTO); +public interface IApiLoggingService { + List findApiLogging(LoggingDTO reqDTO); + LoggingDTO findApiLogging(); + void saveApiLogging(LoggingDTO reqDTO); + void modifyApiLogging(LoggingDTO reqDTO); } diff --git a/mens-api/src/main/java/kr/xit/core/spring/util/ApiSpringUtils.java b/mens-api/src/main/java/kr/xit/core/spring/util/ApiSpringUtils.java index a8d640a..60c544c 100644 --- a/mens-api/src/main/java/kr/xit/core/spring/util/ApiSpringUtils.java +++ b/mens-api/src/main/java/kr/xit/core/spring/util/ApiSpringUtils.java @@ -2,9 +2,9 @@ package kr.xit.core.spring.util; import kr.xit.biz.cmm.service.CmmEnsCacheService; import kr.xit.biz.cmm.service.ICmmEnsCacheService; +import kr.xit.biz.kt.service.IBizKtMmsService; import kr.xit.biz.nice.service.IBizNiceCiService; import kr.xit.core.spring.config.support.ApplicationContextProvider; -import kr.xit.ens.kt.service.IKtMmsService; import kr.xit.ens.nice.service.INiceCiService; import lombok.AccessLevel; import lombok.NoArgsConstructor; @@ -58,7 +58,7 @@ public class ApiSpringUtils { return (IBizNiceCiService)getBean(IBizNiceCiService.class); } - public static IKtMmsService getKtMmsService(){ - return (IKtMmsService)getBean(IKtMmsService.class); + public static IBizKtMmsService getBizKtMmsService(){ + return (IBizKtMmsService)getBean(IBizKtMmsService.class); } } diff --git a/mens-api/src/main/java/kr/xit/ens/cmm/CmmEnsUtils.java b/mens-api/src/main/java/kr/xit/ens/cmm/CmmEnsUtils.java index 60ee6cf..0314999 100644 --- a/mens-api/src/main/java/kr/xit/ens/cmm/CmmEnsUtils.java +++ b/mens-api/src/main/java/kr/xit/ens/cmm/CmmEnsUtils.java @@ -34,11 +34,11 @@ import kr.xit.biz.ens.model.cmm.CmmEnsRequestDTO; import kr.xit.biz.ens.model.cmm.CmmEnsRlaybsnmDTO; import kr.xit.biz.ens.model.kt.KtCommonDTO.ErrorMsg; import kr.xit.biz.ens.model.kt.KtCommonDTO.KtMnsRequest; +import kr.xit.biz.kt.service.IBizKtMmsService; import kr.xit.core.exception.BizRuntimeException; import kr.xit.core.spring.util.ApiSpringUtils; import kr.xit.core.spring.util.CoreSpringUtils; import kr.xit.core.support.utils.DateUtils; -import kr.xit.ens.kt.service.IKtMmsService; import lombok.AccessLevel; import lombok.NoArgsConstructor; import org.apache.commons.lang3.ObjectUtils; @@ -65,7 +65,7 @@ import org.springframework.util.Base64Utils; public class CmmEnsUtils { private static final EgovMessageSource messageSource = CoreSpringUtils.getMessageSource(); private static final ICmmEnsCacheService cacheService = ApiSpringUtils.getCmmEnsCacheService(); - private static final IKtMmsService ktMmsService = ApiSpringUtils.getKtMmsService(); + private static final IBizKtMmsService bizKtService = ApiSpringUtils.getBizKtMmsService(); /** * 문서 중개자 인증 정보 조회 @@ -83,17 +83,18 @@ public class CmmEnsUtils { .build(); final CmmEnsRlaybsnmDTO dto = cacheService.getRlaybsnmInfoCache(ensDTO); - cacheService.logCache(); - if(ObjectUtils.isEmpty(dto)) throw BizRuntimeException.create(messageSource.getMessage("fail.api.rlaybsnm.info")); // KT인 경우 토큰유효기간 check if(SndngSeCode.KT_BC.equals(seCode)){ + if(StringUtils.isNotEmpty(dto.getKtTokenExpiresIn()) - && DateUtils.getTodayAndNowTime(ApiConstants.FMT_DT_STD).compareTo(dto.getKtTokenExpiresIn()) < 0) return dto; + && DateUtils.getTodayAndNowTime(ApiConstants.FMT_DT_STD).compareTo(dto.getKtTokenExpiresIn()) < 0 + && ObjectUtils.isNotEmpty(dto.getKtAccessToken()) + ) return dto; // 유효기간이 경과된 경우 재발급 - ktMmsService.requestToken( + bizKtService.requestToken( KtMnsRequest.builder() .signguCode(signguCode) .ffnlgCode(ffnlgCode) 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 d87869a..cb3bde1 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 @@ -1,8 +1,12 @@ package kr.xit.ens.kt.service; +import egovframework.com.cmm.EgovMessageSource; import java.util.HashMap; import java.util.Map; +import kr.xit.biz.cmm.service.ICmmEnsCacheService; +import kr.xit.biz.common.ApiConstants; import kr.xit.biz.common.ApiConstants.SndngSeCode; +import kr.xit.biz.ens.model.cmm.CmmEnsRequestDTO; import kr.xit.biz.ens.model.cmm.CmmEnsRlaybsnmDTO; import kr.xit.biz.ens.model.kt.KtAcmdDTO.KtAcmdCerfRequest; import kr.xit.biz.ens.model.kt.KtAcmdDTO.KtAcmdCerfResponse; @@ -156,6 +160,8 @@ public class KtMmsService extends EgovAbstractServiceImpl implements IKtMmsServi private String API_APPROVE_RCV; private final ApiWebClientUtil webClient; + private final ICmmEnsCacheService cacheService; + private final EgovMessageSource messageSource; //----------------------------------------------------------- @@ -165,7 +171,12 @@ public class KtMmsService extends EgovAbstractServiceImpl implements IKtMmsServi @Override @TraceLogging public KtTokenResponse requestToken(final KtMnsRequest paramDTO) { - final CmmEnsRlaybsnmDTO ktMnsInfo = getRlaybsnmInfo(paramDTO); + final CmmEnsRlaybsnmDTO ktMnsInfo = cacheService.getRlaybsnmInfoCache(CmmEnsRequestDTO.builder() + .signguCode(paramDTO.getSignguCode()) + .ffnlgCode(paramDTO.getFfnlgCode()) + .profile(ApiConstants.PROFILE) + .build()); + final KtTokenRequest reqDTO = KtTokenRequest.builder() .clientId(ktMnsInfo.getKtSvcClientId()) .clientSecret(ktMnsInfo.getKtSvcClientSecret()) diff --git a/mens-api/src/main/java/kr/xit/ens/kt/web/KtMmsController.java b/mens-api/src/main/java/kr/xit/ens/kt/web/KtMmsController.java index d08fe07..f666354 100644 --- a/mens-api/src/main/java/kr/xit/ens/kt/web/KtMmsController.java +++ b/mens-api/src/main/java/kr/xit/ens/kt/web/KtMmsController.java @@ -25,7 +25,6 @@ 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.kt.service.IBizKtMmsService; import kr.xit.core.model.ApiResponseDTO; import kr.xit.core.model.IApiResponse; import kr.xit.ens.kt.service.IKtMmsService; @@ -58,7 +57,6 @@ import org.springframework.web.bind.annotation.RestController; public class KtMmsController { private final IKtMmsService service; - private final IBizKtMmsService bizService; //------------------------------------------------------------------------------ // mens 사용 API @@ -69,7 +67,7 @@ public class KtMmsController { return ApiResponseDTO.success(service.requestToken(paramDTO)); } - @Operation(summary = "본문자 수신 등록 요청(BC-AG-SN-002) -> 업무(Biz)단 API 사용", description = "본문자 수신 등록 요청(BC-AG-SN-002) -> bulk처리를 위해 업무단의 API를 사용하여야 함") + @Operation(summary = "본문자 수신 등록 요청(BC-AG-SN-002)", description = "본문자 수신 등록 요청(BC-AG-SN-002)") @PostMapping(value = "/mainSend", produces = MediaType.APPLICATION_JSON_VALUE) public IApiResponse mainSend(@RequestBody final KtMainSendRequest reqDTO) { KtCommonResponse dto = service.mainSend(reqDTO); 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 bf89620..562de5e 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 @@ -51,8 +51,11 @@ IF(#{profile} = 'prod', kt_prod_client_secret, kt_dev_client_secret) AS ktSvcClientSecret, /* KT client service secret */ IF(#{profile} = 'prod', kt_prod_service_cerf_key, kt_dev_service_cerf_key) AS ktSvcCerfKey, /* KT client service cerf key */ IF(#{profile} = 'prod', kt_prod_access_token, kt_dev_access_token) AS ktAccessToken, /* KT access token */ - DATE_ADD(NOW(), INTERVAL IF(#{profile} = 'prod', kt_prod_token_expires_in, kt_dev_token_expires_in) - 86400 SECOND) AS ktTokenExpiresIn, /* KT 토큰 유효기간 : (7775999)(90일) */ IF(#{profile} = 'prod', kt_prod_token_jti, kt_dev_token_jti) AS ktTokenJti, /* KT 토큰 식별자 */ + CASE WHEN IFNULL(IF(#{profile} = 'prod', kt_prod_token_expires_in, kt_dev_token_expires_in), '') = '' + THEN NULL + ELSE DATE_ADD(NOW(), INTERVAL IF(#{profile} = 'prod', kt_prod_token_expires_in, kt_dev_token_expires_in) - 86400 SECOND) + END AS ktTokenExpiresIn, /* KT 토큰 유효기간 : (7775999)(90일) */ epost_service_key, /* epost service key */ pplus_api_key, /* postplus api key */ sender_nm, /* 발송인 명 */ diff --git a/mens-api/src/main/resources/egovframework/mapper/core/logging-mysql-mapper.xml b/mens-api/src/main/resources/egovframework/mapper/core/logging-mysql-mapper.xml index f68b09f..2c0d2d4 100644 --- a/mens-api/src/main/resources/egovframework/mapper/core/logging-mysql-mapper.xml +++ b/mens-api/src/main/resources/egovframework/mapper/core/logging-mysql-mapper.xml @@ -2,10 +2,10 @@ - + - - /** logging-mysql-mapper|saveLogging|julim */ + + /** logging-mysql-mapper|saveApiLogging|julim */ INSERT INTO tb_cmm_api_log ( request_id , system_id @@ -39,7 +39,7 @@ ) - + /** logging-mysql-mapper|updateLogging|julim */ UPDATE tb_cmm_api_log SET success = #{success} @@ -50,8 +50,8 @@ WHERE request_id = #{requestId} - + /** logging-mysql-mapper|selectApiLogging|julim */ SELECT request_id , system_id , req_system_id diff --git a/mens-batch/src/main/java/kr/xit/biz/ens/service/EnsBatchSendService.java b/mens-batch/src/main/java/kr/xit/biz/ens/service/EnsBatchSendService.java index bd12601..0acc1ed 100644 --- a/mens-batch/src/main/java/kr/xit/biz/ens/service/EnsBatchSendService.java +++ b/mens-batch/src/main/java/kr/xit/biz/ens/service/EnsBatchSendService.java @@ -355,10 +355,8 @@ public class EnsBatchSendService extends EgovAbstractServiceImpl implements IEns throw e; } - // mobile page create - sendReqs.forEach(d -> mapper.insertKtMobilePageManage(d.getSrcKey())); - final List> partitions = ListUtils.partition(sendReqs, bulkKtMaxCnt); + @SuppressWarnings("rawtypes") List apiResults = partitions.stream() .map(bulkSendList -> { mstDTO.setReqs(bulkSendList); @@ -374,6 +372,7 @@ public class EnsBatchSendService extends EgovAbstractServiceImpl implements IEns boolean isSuccess = false; List errList = new ArrayList<>(); + //noinspection rawtypes for(ApiResponseDTO apiResult : apiResults) { // KT-BC API 정상 호출 if(ObjectUtils.isNotEmpty(apiResult.getData())) { @@ -411,6 +410,8 @@ public class EnsBatchSendService extends EgovAbstractServiceImpl implements IEns extractService.updateSndngMstFailStatus(mstId, SndngSeCode.KT_BC, dto.getErrorCode(), dto.getErrorMssage(), "[send] KT-BC 발송(bulks)요청 실패"); return; } + // mobile page create + sendReqs.forEach(d -> mapper.insertKtMobilePageManage(d.getSrcKey())); // 성공 건수 존재시 성공 처리 dto.setResultCd("00"); @@ -452,6 +453,7 @@ public class EnsBatchSendService extends EgovAbstractServiceImpl implements IEns private void sendBulkPplus(final SndngMssageParam dto) { final String url = apiHost + apiPplusBulkSend; + //noinspection rawtypes ApiResponseDTO apiResult = apiWebClient.exchange( url, HttpMethod.POST, diff --git a/mens-batch/src/main/resources/egovframework/mapper/core/batch-cmm-mysql-mapper.xml b/mens-batch/src/main/resources/egovframework/mapper/core/batch-cmm-mysql-mapper.xml index 23f9065..f18ad86 100644 --- a/mens-batch/src/main/resources/egovframework/mapper/core/batch-cmm-mysql-mapper.xml +++ b/mens-batch/src/main/resources/egovframework/mapper/core/batch-cmm-mysql-mapper.xml @@ -29,7 +29,7 @@ /** batch-cmm-mysql-mapper|updateBatchLock-배치 실행 상태 및 결과 반영|julim */ UPDATE tb_cmm_batch_lock SET result = #{result} - , message = IFNULL(SUBSTRING(#{message}, 1, 200), message) + , message = SUBSTRING(#{message}, 1, 200) , use_yn = #{useYn} , updt_dt = NOW(3) WHERE instance_id = #{instanceId}