feat: AbstractService 추가

-> EgovAbstractServiceImpl extends
      Service class AbstractService extends로 변경
      Exception 클래스 패키지 이동
      EgovMessageSource class 삭제
      MessageUtil 추가
dev
gitea-관리자 12 months ago
parent da81106f86
commit 219307bab4

@ -1,6 +1,5 @@
package kr.xit.biz.kt.service;
import egovframework.com.cmm.EgovMessageSource;
import java.util.List;
import kr.xit.biz.cmm.service.ICmmEnsCacheService;
import kr.xit.biz.common.ApiConstants;
@ -14,6 +13,7 @@ import kr.xit.biz.ens.model.kt.KtMmsSendDTO.KtMsgRsltRequest;
import kr.xit.biz.ens.model.kt.KtTokenDTO.KtTokenResponse;
import kr.xit.biz.kt.mapper.IBizKtMmsMapper;
import kr.xit.core.exception.BizRuntimeException;
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;
@ -22,8 +22,6 @@ import kr.xit.ens.kt.service.IKtMmsService;
import kr.xit.ens.kt.web.KtMmsInboundController;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -44,18 +42,10 @@ import org.springframework.transaction.annotation.Transactional;
*/
@RequiredArgsConstructor
@Service
public class BizKtMmsService extends EgovAbstractServiceImpl implements IBizKtMmsService {
private static final int MAX_KT_SEND_CNT = 100;
@Value("${app.contract.kt.api.dp-callback-url}")
private String DP_CALLBACK_URL;
@Value("${app.contract.kt.api.me-callback-url}")
private String ME_CALLBACK_URL;
public class BizKtMmsService extends AbstractService implements IBizKtMmsService {
private final IKtMmsService ktMmsService;
private final ICmmEnsCacheService cacheService;
private final IBizKtMmsMapper mapper;
private final EgovMessageSource messageSource;
/**
* <pre>
@ -124,7 +114,7 @@ public class BizKtMmsService extends EgovAbstractServiceImpl implements IBizKtMm
if("40".equals(dto.getMmsSndgRsltDvcd()) && Checks.isNotEmpty(dto.getMmsRdgTmst())){
dto.setMmsSndgRsltDvcd("60");
}
dto.setMmsSndgRsltDvcdMsg(messageSource.getMessage("info.api.kt.msg.rslt."+dto.getMmsSndgRsltDvcd()));
dto.setMmsSndgRsltDvcdMsg(messageUtil.getMessage("info.api.kt.msg.rslt."+dto.getMmsSndgRsltDvcd()));
if(mapper.updateKtBcDtl(dto) != 1) {
errors.add(new ErrorMsg(
String.format("존재 하지 않는 발송 대상(src_key[%s], mms_sndg_rslt_sqno[%s]) 입니다",

@ -9,13 +9,13 @@ 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.ens.kakao.service.IKkopayEltrcDocService;
import kr.xit.ens.kt.service.IKtMmsService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
import org.springframework.stereotype.Service;
/**
@ -36,7 +36,7 @@ import org.springframework.stereotype.Service;
@Slf4j
@RequiredArgsConstructor
@Service
public class MobilePageService extends EgovAbstractServiceImpl implements IMobilePageService {
public class MobilePageService extends AbstractService implements IMobilePageService {
private final IMobilePageMapper mapper;
private final IKkopayEltrcDocService kkoService;
private final IKtMmsService ktMmsService;

@ -1,6 +1,5 @@
package kr.xit.biz.nice.service;
import egovframework.com.cmm.EgovMessageSource;
import kr.xit.biz.cmm.service.CmmEnsCacheService;
import kr.xit.biz.common.ApiConstants.NiceCiWrkDiv;
import kr.xit.biz.common.ApiConstants.SignguCode;
@ -17,12 +16,12 @@ import kr.xit.biz.ens.model.nice.NiceCiDTO.TokenRevokeResDataBody;
import kr.xit.biz.ens.model.nice.NiceCiDTO.TokenRevokeResponse;
import kr.xit.biz.nice.mapper.IBizNiceCiMapper;
import kr.xit.core.exception.BizRuntimeException;
import kr.xit.core.service.AbstractService;
import kr.xit.ens.nice.cmm.CmmNiceCiUtils;
import kr.xit.ens.nice.service.INiceCiService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -44,8 +43,7 @@ import org.springframework.transaction.annotation.Transactional;
@Slf4j
@RequiredArgsConstructor
@Service
public class BizNiceCiService extends EgovAbstractServiceImpl implements IBizNiceCiService {
private final EgovMessageSource messageSource;
public class BizNiceCiService extends AbstractService implements IBizNiceCiService {
private final INiceCiService niceCiService;
private final CmmEnsCacheService cacheService;
private final IBizNiceCiMapper niceCiMapper;
@ -150,7 +148,7 @@ public class BizNiceCiService extends EgovAbstractServiceImpl implements IBizNic
@Transactional
public PublickeyResDataBody requestPublickey(final NiceCiRequest reqDTO) {
final NiceCiInfo niceDTO = CmmNiceCiUtils.getNiceCiInfo(reqDTO);
if(ObjectUtils.isEmpty(niceDTO.getAccessToken())) throw BizRuntimeException.create(messageSource.getMessage("fail.api.nice.token.info"));
if(ObjectUtils.isEmpty(niceDTO.getAccessToken())) throw BizRuntimeException.create(messageUtil.getMessage("fail.api.nice.token.info"));
final PublickeyResDataBody dataBody = niceCiService.requestPublickey(reqDTO);

@ -29,6 +29,7 @@ import kr.xit.biz.sisul.model.SisulSndngResultDTO.RsltSisulRequest;
import kr.xit.biz.sisul.model.SisulSndngResultDTO.RsltSisulResDtlData;
import kr.xit.biz.sisul.model.SisulSndngResultDTO.RsltSisulResMstData;
import kr.xit.core.exception.BizRuntimeException;
import kr.xit.core.service.AbstractService;
import kr.xit.core.support.utils.Checks;
import kr.xit.core.support.xlsx.StreamingReader;
import kr.xit.ens.cmm.CmmEnsUtils;
@ -42,7 +43,6 @@ import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
import org.jasypt.encryption.StringEncryptor;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
@ -68,7 +68,7 @@ import org.springframework.web.multipart.MultipartFile;
@Slf4j
@RequiredArgsConstructor
@Service
public class BizSisulService extends EgovAbstractServiceImpl implements IBizSisulService {
public class BizSisulService extends AbstractService implements IBizSisulService {
private final static int FMC_EXCEL_DATA_START_ROW = 1;
private final static int FMC_EXCEL_CELL_CNT = 58;

@ -12,8 +12,8 @@ import javax.servlet.http.HttpServletRequest;
import kr.xit.core.biz.model.LoggingDTO;
import kr.xit.core.biz.service.IApiLoggingService;
import kr.xit.core.exception.BizRuntimeException;
import kr.xit.core.exception.ErrorParse;
import kr.xit.core.model.ApiResponseDTO;
import kr.xit.core.spring.util.error.ErrorParse;
import kr.xit.core.support.slack.SlackWebhookPush;
import kr.xit.core.support.utils.Checks;
import kr.xit.core.support.utils.JsonUtils;

@ -1,6 +1,5 @@
package kr.xit.core.biz.web;
import egovframework.com.cmm.EgovMessageSource;
import egovframework.com.cmm.LoginVO;
import egovframework.com.cmm.jwt.config.EgovJwtTokenUtil;
import io.swagger.v3.oas.annotations.Operation;
@ -14,6 +13,7 @@ import kr.xit.core.biz.service.IAuthApiService;
import kr.xit.core.consts.Constants;
import kr.xit.core.model.ApiResponseDTO;
import kr.xit.core.model.IApiResponse;
import kr.xit.core.spring.util.MessageUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
@ -55,7 +55,7 @@ public class AuthApiController {
/** EgovMessageSource */
private final EgovMessageSource egovMessageSource;
private final MessageUtil messageUtil;
private final EgovJwtTokenUtil egovJwtTokenUtil;
/**
@ -91,7 +91,7 @@ public class AuthApiController {
request.getSession().setAttribute(Constants.AuthSaveSession.LOGIN_VO.getCode(), loginResultVO);
return ApiResponseDTO.success(loginResultVO);
}
return ApiResponseDTO.success(egovMessageSource.getMessage("fail.common.login"));
return ApiResponseDTO.success(messageUtil.getMessage("fail.common.login"));
}
@io.swagger.v3.oas.annotations.parameters.RequestBody(
@ -176,7 +176,7 @@ public class AuthApiController {
return ApiResponseDTO.success(resultMap);
}
return ApiResponseDTO.error(egovMessageSource.getMessage("fail.common.login") );
return ApiResponseDTO.error(messageUtil.getMessage("fail.common.login") );
}
/**

@ -1,6 +1,5 @@
package kr.xit.ens.cmm;
import egovframework.com.cmm.EgovMessageSource;
import java.nio.charset.StandardCharsets;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
@ -38,6 +37,7 @@ 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.spring.util.MessageUtil;
import kr.xit.core.support.utils.DateUtils;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
@ -63,7 +63,7 @@ import org.springframework.util.Base64Utils;
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class CmmEnsUtils {
private static final EgovMessageSource messageSource = CoreSpringUtils.getMessageSource();
private static final MessageUtil messageUtil = CoreSpringUtils.getMessageUtil();
private static final ICmmEnsCacheService cacheService = ApiSpringUtils.getCmmEnsCacheService();
private static final IBizKtMmsService bizKtService = ApiSpringUtils.getBizKtMmsService();
@ -83,7 +83,7 @@ public class CmmEnsUtils {
.build();
final CmmEnsRlaybsnmDTO dto = cacheService.getRlaybsnmInfoCache(ensDTO);
if(ObjectUtils.isEmpty(dto)) throw BizRuntimeException.create(messageSource.getMessage("fail.api.rlaybsnm.info"));
if(ObjectUtils.isEmpty(dto)) throw BizRuntimeException.create(messageUtil.getMessage("fail.api.rlaybsnm.info"));
// KT인 경우 토큰유효기간 check
if(SndngSeCode.KT_BC.equals(seCode)){

@ -6,12 +6,12 @@ import kr.xit.biz.common.ApiConstants.SndngSeCode;
import kr.xit.biz.ens.model.cmm.CmmEnsRlaybsnmDTO;
import kr.xit.biz.ens.model.epost.EPostDTO.EpostTraceRequest;
import kr.xit.biz.ens.model.epost.EPostDTO.EpostTraceResponse;
import kr.xit.core.service.AbstractService;
import kr.xit.core.spring.annotation.TraceLogging;
import kr.xit.core.spring.util.ApiWebClientUtil;
import kr.xit.ens.cmm.CmmEnsUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
@ -36,7 +36,7 @@ import org.springframework.stereotype.Service;
@Slf4j
@RequiredArgsConstructor
@Service
public class EpostService extends EgovAbstractServiceImpl implements IEpostService {
public class EpostService extends AbstractService implements IEpostService {
@Value("${app.contract.epost.host}")
private String HOST;

@ -1,12 +1,12 @@
package kr.xit.ens.kakao.cmm;
import egovframework.com.cmm.EgovMessageSource;
import kr.xit.biz.cmm.service.ICmmEnsCacheService;
import kr.xit.biz.ens.model.cmm.CmmEnsRequestDTO;
import kr.xit.biz.ens.model.cmm.CmmEnsRlaybsnmDTO;
import kr.xit.core.exception.BizRuntimeException;
import kr.xit.core.spring.util.ApiSpringUtils;
import kr.xit.core.spring.util.CoreSpringUtils;
import kr.xit.core.spring.util.MessageUtil;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.ObjectUtils;
@ -29,7 +29,7 @@ import org.apache.commons.lang3.ObjectUtils;
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class CmmKakaoUtils {
private static final EgovMessageSource messageSource = CoreSpringUtils.getMessageSource();
private static final MessageUtil messageUtil = CoreSpringUtils.getMessageUtil();
private static final ICmmEnsCacheService cacheService = ApiSpringUtils.getCmmEnsCacheService();
/**
@ -38,7 +38,7 @@ public class CmmKakaoUtils {
*/
public static CmmEnsRlaybsnmDTO getRlaybsnmInfo(final CmmEnsRequestDTO dto) {
final CmmEnsRlaybsnmDTO ensDTO = cacheService.getRlaybsnmInfoCache(dto);
if(ObjectUtils.isEmpty(dto)) throw BizRuntimeException.create(messageSource.getMessage("fail.api.rlaybsnm.info"));
if(ObjectUtils.isEmpty(dto)) throw BizRuntimeException.create(messageUtil.getMessage("fail.api.rlaybsnm.info"));
cacheService.logCache();
return ensDTO;

@ -5,11 +5,9 @@ import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
import javax.validation.ConstraintViolation;
import javax.validation.Validation;
import javax.validation.Validator;
import kr.xit.biz.ens.model.cmm.CmmEnsRequestDTO;
import kr.xit.biz.ens.model.cmm.CmmEnsRlaybsnmDTO;
import kr.xit.biz.ens.model.kakao.KkopayDocAttrDTO.DocumentBinderUuid;
@ -26,6 +24,7 @@ import kr.xit.biz.ens.model.kakao.KkopayDocDTO.ValidTokenRequest;
import kr.xit.biz.ens.model.kakao.KkopayDocDTO.ValidTokenResponse;
import kr.xit.core.exception.BizRuntimeException;
import kr.xit.core.model.ApiResponseDTO;
import kr.xit.core.service.AbstractService;
import kr.xit.core.spring.annotation.TraceLogging;
import kr.xit.core.spring.util.ApiWebClientUtil;
import kr.xit.core.support.utils.Checks;
@ -33,7 +32,6 @@ import kr.xit.core.support.utils.JsonUtils;
import kr.xit.ens.kakao.cmm.CmmKakaoUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpMethod;
import org.springframework.scheduling.annotation.Async;
@ -57,7 +55,7 @@ import org.springframework.stereotype.Component;
@Slf4j
@RequiredArgsConstructor
@Component
public class AsyncKkopayEltrcDocService extends EgovAbstractServiceImpl implements
public class AsyncKkopayEltrcDocService extends AbstractService implements
IAsyncKkopayEltrcDocService {
@Value("${app.contract.kakao.host}")

@ -27,6 +27,7 @@ import kr.xit.biz.ens.model.kakao.KkopayDocDTO.ValidTokenResponse;
import kr.xit.biz.ens.model.kakao.KkopayErrorDTO;
import kr.xit.core.exception.BizRuntimeException;
import kr.xit.core.model.ApiResponseDTO;
import kr.xit.core.service.AbstractService;
import kr.xit.core.spring.annotation.TraceLogging;
import kr.xit.core.spring.util.ApiWebClientUtil;
import kr.xit.core.support.utils.Checks;
@ -35,7 +36,6 @@ import kr.xit.ens.cmm.CmmEnsUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Component;
@ -57,7 +57,7 @@ import org.springframework.stereotype.Component;
@Slf4j
@RequiredArgsConstructor
@Component
public class KkopayEltrcDocService extends EgovAbstractServiceImpl implements
public class KkopayEltrcDocService extends AbstractService implements
IKkopayEltrcDocService {
@Value("${app.contract.kakao.host}")

@ -1,6 +1,5 @@
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;
@ -35,13 +34,13 @@ import kr.xit.biz.ens.model.kt.KtTokenDTO.KtTokenExcaRequest;
import kr.xit.biz.ens.model.kt.KtTokenDTO.KtTokenReadRequest;
import kr.xit.biz.ens.model.kt.KtTokenDTO.KtTokenRequest;
import kr.xit.biz.ens.model.kt.KtTokenDTO.KtTokenResponse;
import kr.xit.core.service.AbstractService;
import kr.xit.core.spring.annotation.TraceLogging;
import kr.xit.core.spring.util.ApiWebClientUtil;
import kr.xit.core.support.utils.DateUtils;
import kr.xit.core.support.utils.JsonUtils;
import kr.xit.ens.cmm.CmmEnsUtils;
import lombok.RequiredArgsConstructor;
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
@ -65,7 +64,7 @@ import org.springframework.stereotype.Service;
*/
@RequiredArgsConstructor
@Service
public class KtMmsService extends EgovAbstractServiceImpl implements IKtMmsService {
public class KtMmsService extends AbstractService implements IKtMmsService {
@Value("${app.contract.kt.host}")
private String HOST;
//-----------------------------------------------------------------
@ -161,7 +160,6 @@ public class KtMmsService extends EgovAbstractServiceImpl implements IKtMmsServi
private final ApiWebClientUtil webClient;
private final ICmmEnsCacheService cacheService;
private final EgovMessageSource messageSource;
//-----------------------------------------------------------

@ -1,6 +1,5 @@
package kr.xit.ens.nice.cmm;
import egovframework.com.cmm.EgovMessageSource;
import java.nio.charset.StandardCharsets;
import java.util.Date;
import java.util.HashMap;
@ -18,6 +17,7 @@ import kr.xit.biz.nice.service.IBizNiceCiService;
import kr.xit.core.exception.BizRuntimeException;
import kr.xit.core.spring.util.ApiSpringUtils;
import kr.xit.core.spring.util.CoreSpringUtils;
import kr.xit.core.spring.util.MessageUtil;
import kr.xit.core.support.utils.DateUtils;
import kr.xit.core.support.utils.JsonUtils;
import kr.xit.ens.cmm.CmmEnsUtils;
@ -47,18 +47,19 @@ import org.springframework.util.Base64Utils;
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class CmmNiceCiUtils {
private static final EgovMessageSource messageSource = CoreSpringUtils.getMessageSource();
private static final MessageUtil messageUtil = CoreSpringUtils.getMessageUtil();
private static final ICmmEnsCacheService cacheService = ApiSpringUtils.getCmmEnsCacheService();
private static final INiceCiService niceCiService = ApiSpringUtils.getNiceCiService();
private static final IBizNiceCiService bizNiceService = ApiSpringUtils.getBizNiceCiService();
/**
* Nice
* @return
* @param reqDTO NiceCiRequest
* @return NiceCiInfo
*/
public static NiceCiInfo getNiceCiInfo(final NiceCiRequest reqDTO) {
final NiceCiInfo dto = cacheService.getNiceCiInfoCache(reqDTO.getSignguCode(), reqDTO.getFfnlgCode());
if(ObjectUtils.isEmpty(dto)) throw BizRuntimeException.create(messageSource.getMessage("fail.api.nice.info"));
if(ObjectUtils.isEmpty(dto)) throw BizRuntimeException.create(messageUtil.getMessage("fail.api.nice.info"));
cacheService.logCache();
return dto;
@ -72,12 +73,13 @@ public class CmmNiceCiUtils {
* 1.
* 2.
* 4. cache reload
* @return
* @param reqDTO NiceCiRequest
* @return NiceCiRequest
* </pre>
*/
public static NiceCiInfo getPublickeyNiceCiInfo(final NiceCiRequest reqDTO) {
final NiceCiInfo niceDTO = getNiceCiInfo(reqDTO);
if(ObjectUtils.isEmpty(niceDTO.getAccessToken())) throw BizRuntimeException.create(messageSource.getMessage("fail.api.nice.token.info"));
if(ObjectUtils.isEmpty(niceDTO.getAccessToken())) throw BizRuntimeException.create(messageUtil.getMessage("fail.api.nice.token.info"));
if(StringUtils.isNotEmpty(niceDTO.getValidDtim())
&& DateUtils.getTodayAndNowTime(ApiConstants.FMT_DT_EMPTY_DLT).compareTo(niceDTO.getValidDtim()) < 0) return niceDTO;
@ -103,6 +105,7 @@ public class CmmNiceCiUtils {
* -->
* 1.
* 4. cache reload
* @param reqDTO NiceCiRequest
* @return NiceCiInfo
* </pre>
*/
@ -135,6 +138,15 @@ public class CmmNiceCiUtils {
.build();
}
/**
* Nice CI API set
* , , ipin
* @param contentType String
* @param type String
* @param accessToken String
* @param clientId String
* @return Map<String,String>
*/
public static Map<String,String> getAuthHeaderMap(final String contentType, final String type, final String accessToken, final String clientId){
final Map<String,String> map = new HashMap<>();
if(ObjectUtils.isNotEmpty(contentType)) map.put(HttpHeaders.CONTENT_TYPE, contentType);
@ -151,13 +163,19 @@ public class CmmNiceCiUtils {
return map;
}
/**
* Nice CI return
* @param wrkDiv API - ||ipin
* @param resultCd String
* @return String
*/
public static String getFromResultCd(NiceCiWrkDiv wrkDiv, String resultCd){
final String preFix = "err.api.nice";
return switch(wrkDiv) {
case PUBLIC_KEY -> messageSource.getMessage(preFix + ".pubKey." + resultCd);
case SYM_KEY -> messageSource.getMessage(preFix + ".symKey." + resultCd);
case CI -> messageSource.getMessage(preFix + ".ci." + resultCd);
case PUBLIC_KEY -> messageUtil.getMessage(preFix + ".pubKey." + resultCd);
case SYM_KEY -> messageUtil.getMessage(preFix + ".symKey." + resultCd);
case CI -> messageUtil.getMessage(preFix + ".ci." + resultCd);
default -> StringUtils.EMPTY;
};
}
@ -182,7 +200,7 @@ public class CmmNiceCiUtils {
}
// 성공(1200)시 tranId 체크
if(!tranId.equals(resHeader.getTranId())) throw BizRuntimeException.create(messageSource.getMessage("fail.api.nice.invalid.tranId"));
if(!tranId.equals(resHeader.getTranId())) throw BizRuntimeException.create(messageUtil.getMessage("fail.api.nice.invalid.tranId"));
// 실패
if(ObjectUtils.isNotEmpty(resBody) && !resBody.getRspCd().equals("P000")) {

@ -1,6 +1,5 @@
package kr.xit.ens.nice.service;
import egovframework.com.cmm.EgovMessageSource;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
@ -8,6 +7,7 @@ import kr.xit.biz.common.ApiConstants;
import kr.xit.biz.common.ApiConstants.NiceCiWrkDiv;
import kr.xit.biz.ens.model.nice.NiceCiDTO.*;
import kr.xit.core.exception.BizRuntimeException;
import kr.xit.core.service.AbstractService;
import kr.xit.core.spring.annotation.TraceLogging;
import kr.xit.core.spring.util.ApiWebClientUtil;
import kr.xit.core.support.utils.DateUtils;
@ -18,7 +18,6 @@ import kr.xit.ens.nice.cmm.CmmNiceCiUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
@ -44,7 +43,7 @@ import org.springframework.util.Base64Utils;
@Slf4j
@RequiredArgsConstructor
@Service
public class NiceCiService extends EgovAbstractServiceImpl implements INiceCiService {
public class NiceCiService extends AbstractService implements INiceCiService {
@Value("${app.contract.nice.host}")
private String HOST;
@ -63,7 +62,6 @@ public class NiceCiService extends EgovAbstractServiceImpl implements INiceCiSer
private static final String AUTH_TYPE_BEARER = "bearer";
private static final String CNTY_CD = "ko";
private final EgovMessageSource messageSource;
private final ApiWebClientUtil webClient;
//--------------------------------------------------------------------------------
@ -113,7 +111,7 @@ public class NiceCiService extends EgovAbstractServiceImpl implements INiceCiSer
@TraceLogging
public TokenRevokeResponse revokeToken(final NiceCiRequest reqDTO){
final NiceCiInfo niceDTO = CmmNiceCiUtils.getNiceCiInfo(reqDTO);
if(ObjectUtils.isEmpty(niceDTO.getAccessToken())) throw BizRuntimeException.create(messageSource.getMessage("fail.api.nice.token.info"));
if(ObjectUtils.isEmpty(niceDTO.getAccessToken())) throw BizRuntimeException.create(messageUtil.getMessage("fail.api.nice.token.info"));
return webClient.exchangeFormData(
HOST + API_REVOKE_TOKEN,
@ -136,7 +134,7 @@ public class NiceCiService extends EgovAbstractServiceImpl implements INiceCiSer
@TraceLogging
public PublickeyResDataBody requestPublickey(final NiceCiRequest reqDTO) {
final NiceCiInfo niceDTO = CmmNiceCiUtils.getNiceCiInfo(reqDTO);
if(ObjectUtils.isEmpty(niceDTO.getAccessToken())) throw BizRuntimeException.create(messageSource.getMessage("fail.api.nice.token.info"));
if(ObjectUtils.isEmpty(niceDTO.getAccessToken())) throw BizRuntimeException.create(messageUtil.getMessage("fail.api.nice.token.info"));
final String todayDt = DateUtils.getTodayAndNowTime(ApiConstants.FMT_DT_EMPTY_DLT);
final String tranId = CmmEnsUtils.generateLengthUuid(24);

@ -13,6 +13,7 @@ import kr.xit.biz.ens.model.pplus.PplusDTO.BatchAcceptRequest;
import kr.xit.biz.ens.model.pplus.PplusDTO.PpCommonResponse;
import kr.xit.biz.ens.model.pplus.PplusDTO.PpStatusRequest;
import kr.xit.biz.ens.model.pplus.PplusDTO.PpStatusResponse;
import kr.xit.core.service.AbstractService;
import kr.xit.core.spring.annotation.TraceLogging;
import kr.xit.core.spring.util.ApiWebClientUtil;
import kr.xit.core.support.utils.FileUtil;
@ -21,7 +22,6 @@ import kr.xit.ens.cmm.CmmEnsUtils;
import kr.xit.ens.pplus.mapper.IPplusMapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
import org.jasypt.encryption.StringEncryptor;
import org.json.simple.JSONObject;
import org.springframework.beans.factory.annotation.Value;
@ -49,7 +49,7 @@ import org.springframework.web.multipart.MultipartFile;
@Slf4j
@RequiredArgsConstructor
@Service
public class PplusService extends EgovAbstractServiceImpl implements IPplusService {
public class PplusService extends AbstractService implements IPplusService {
@Value("${app.file.cmm.temp-path}")
private String FILE_TEMP_PATH;

@ -2,7 +2,7 @@ package kr.xit.batch.ens.task;
import kr.xit.batch.ens.task.cmm.TaskCmmUtils;
import kr.xit.biz.ens.service.IEnsCctvFileService;
import kr.xit.core.spring.util.error.ErrorParse;
import kr.xit.core.exception.ErrorParse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.MDC;

@ -2,7 +2,7 @@ package kr.xit.batch.ens.task;
import kr.xit.batch.ens.task.cmm.TaskCmmUtils;
import kr.xit.biz.ens.service.IEnsCctvFileService;
import kr.xit.core.spring.util.error.ErrorParse;
import kr.xit.core.exception.ErrorParse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.MDC;

@ -2,7 +2,7 @@ package kr.xit.batch.ens.task;
import kr.xit.batch.ens.task.cmm.TaskCmmUtils;
import kr.xit.biz.pni.service.IPniCctvFileService;
import kr.xit.core.spring.util.error.ErrorParse;
import kr.xit.core.exception.ErrorParse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.MDC;

@ -2,7 +2,7 @@ package kr.xit.batch.ens.task;
import kr.xit.batch.ens.task.cmm.TaskCmmUtils;
import kr.xit.biz.pni.service.IPniCctvFileService;
import kr.xit.core.spring.util.error.ErrorParse;
import kr.xit.core.exception.ErrorParse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.MDC;

@ -3,7 +3,7 @@ package kr.xit.batch.ens.task;
import kr.xit.batch.ens.task.cmm.TaskCmmUtils;
import kr.xit.biz.ens.model.EnsDTO;
import kr.xit.biz.ens.service.IEnsBatchAcceptService;
import kr.xit.core.spring.util.error.ErrorParse;
import kr.xit.core.exception.ErrorParse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.MDC;

@ -3,7 +3,7 @@ package kr.xit.batch.ens.task;
import kr.xit.batch.ens.task.cmm.TaskCmmUtils;
import kr.xit.biz.ens.model.EnsDTO;
import kr.xit.biz.ens.service.IEnsBatchCloseService;
import kr.xit.core.spring.util.error.ErrorParse;
import kr.xit.core.exception.ErrorParse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.MDC;

@ -7,7 +7,7 @@ import kr.xit.biz.common.ApiConstants;
import kr.xit.biz.ens.model.EnsDTO;
import kr.xit.biz.ens.model.cmm.SndngMssageParam;
import kr.xit.biz.ens.service.IEnsBatchMakeService;
import kr.xit.core.spring.util.error.ErrorParse;
import kr.xit.core.exception.ErrorParse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.MDC;

@ -6,7 +6,7 @@ import kr.xit.batch.ens.task.cmm.TaskCmmUtils;
import kr.xit.biz.ens.model.EnsDTO;
import kr.xit.biz.ens.model.cmm.SndngMssageParam;
import kr.xit.biz.ens.service.IEnsBatchSendService;
import kr.xit.core.spring.util.error.ErrorParse;
import kr.xit.core.exception.ErrorParse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.MDC;

@ -4,7 +4,7 @@ import java.util.UUID;
import kr.xit.batch.ens.task.cmm.TaskCmmUtils;
import kr.xit.biz.ens.model.EnsDTO;
import kr.xit.biz.ens.service.IEnsBatchStatusService;
import kr.xit.core.spring.util.error.ErrorParse;
import kr.xit.core.exception.ErrorParse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.MDC;

@ -15,11 +15,11 @@ import kr.xit.biz.ens.mapper.IEnsBatchMapper;
import kr.xit.biz.ens.model.EnsDTO;
import kr.xit.biz.ens.model.cmm.SndngMssageParam;
import kr.xit.core.exception.BizRuntimeException;
import kr.xit.core.service.AbstractService;
import kr.xit.core.support.utils.Checks;
import kr.xit.core.support.utils.DateUtils;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
import org.slf4j.MDC;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
@ -43,7 +43,7 @@ import org.springframework.transaction.annotation.Transactional;
*/
@RequiredArgsConstructor
@Service
public class EnsBatchAcceptService extends EgovAbstractServiceImpl implements IEnsBatchAcceptService {
public class EnsBatchAcceptService extends AbstractService implements IEnsBatchAcceptService {
private final IEnsBatchMapper mapper;
private static final Validator validator = Validation.buildDefaultValidatorFactory()

@ -6,8 +6,8 @@ import kr.xit.biz.ens.mapper.IEnsBatchMapper;
import kr.xit.biz.ens.model.EnsDTO;
import kr.xit.biz.ens.model.cmm.SndngMssageParam;
import kr.xit.core.exception.BizRuntimeException;
import kr.xit.core.service.AbstractService;
import lombok.RequiredArgsConstructor;
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
@ -30,7 +30,7 @@ import org.springframework.transaction.annotation.Transactional;
*/
@RequiredArgsConstructor
@Service
public class EnsBatchCloseService extends EgovAbstractServiceImpl implements IEnsBatchCloseService {
public class EnsBatchCloseService extends AbstractService implements IEnsBatchCloseService {
private final IEnsBatchMapper mapper;
/**

@ -16,10 +16,10 @@ import kr.xit.biz.ens.model.kakao.KkopayDocBulkDTO.BulkSendResponses;
import kr.xit.biz.ens.model.kt.KtMmsSendDTO.KtMainSendReqData;
import kr.xit.biz.sms.service.ISmsMessageService;
import kr.xit.core.exception.BizRuntimeException;
import kr.xit.core.service.AbstractService;
import kr.xit.core.support.utils.Checks;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
@ -43,7 +43,7 @@ import org.springframework.transaction.annotation.Transactional;
*/
@RequiredArgsConstructor
@Service
public class EnsBatchExtractService extends EgovAbstractServiceImpl implements
public class EnsBatchExtractService extends AbstractService implements
IEnsBatchExtractService {
@Value("${app.file.cmm.upload.root}")
private String fileRoot;

@ -10,9 +10,9 @@ import kr.xit.biz.ens.mapper.IEnsBatchMapper;
import kr.xit.biz.ens.model.EnsDTO;
import kr.xit.biz.ens.model.cmm.SndngMssageParam;
import kr.xit.core.exception.BizRuntimeException;
import kr.xit.core.service.AbstractService;
import kr.xit.core.support.utils.Checks;
import lombok.RequiredArgsConstructor;
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@ -37,7 +37,7 @@ import org.springframework.transaction.annotation.Transactional;
*/
@RequiredArgsConstructor
@Service
public class EnsBatchMakeService extends EgovAbstractServiceImpl implements IEnsBatchMakeService {
public class EnsBatchMakeService extends AbstractService implements IEnsBatchMakeService {
@Value("${app.contract.kt.api.dp-callback-url}")
private String DP_CALLBACK_URL;
@Value("${app.contract.kt.api.me-callback-url}")

@ -29,6 +29,7 @@ import kr.xit.biz.ens.model.kt.KtMmsSendDTO.KtMainSendReqData;
import kr.xit.biz.ens.model.pplus.PplusDTO.PpCommonResponse;
import kr.xit.core.exception.BizRuntimeException;
import kr.xit.core.model.ApiResponseDTO;
import kr.xit.core.service.AbstractService;
import kr.xit.core.spring.util.ApiWebClientUtil;
import kr.xit.core.support.utils.Checks;
import kr.xit.core.support.utils.DateUtils;
@ -37,7 +38,6 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpMethod;
@ -64,7 +64,7 @@ import org.springframework.transaction.annotation.Transactional;
@Slf4j
@RequiredArgsConstructor
@Service
public class EnsBatchSendService extends EgovAbstractServiceImpl implements IEnsBatchSendService {
public class EnsBatchSendService extends AbstractService implements IEnsBatchSendService {
@Value("${app.contract.host}")
private String apiHost;
@Value("${app.contract.kakao.api.bulksend}")

@ -26,13 +26,13 @@ import kr.xit.biz.ens.model.pplus.PplusDTO.PpStatusResponse;
import kr.xit.biz.ens.model.pplus.PplusDTO.PplusResult;
import kr.xit.core.exception.BizRuntimeException;
import kr.xit.core.model.ApiResponseDTO;
import kr.xit.core.service.AbstractService;
import kr.xit.core.spring.util.ApiWebClientUtil;
import kr.xit.core.support.utils.Checks;
import kr.xit.core.support.utils.JsonUtils;
import lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.StringUtils;
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpMethod;
@ -58,7 +58,7 @@ import org.springframework.transaction.annotation.Transactional;
*/
@RequiredArgsConstructor
@Service
public class EnsBatchStatusService extends EgovAbstractServiceImpl implements IEnsBatchStatusService {
public class EnsBatchStatusService extends AbstractService implements IEnsBatchStatusService {
@Value("${app.contract.host}")
private String apiHost;
@Value("${app.contract.kakao.api.bulkstatus}")

@ -1,28 +1,27 @@
package kr.xit.biz.ens.service;
import static egovframework.com.cmm.util.EgovDateUtil.formatDate;
import static egovframework.com.cmm.util.EgovDateUtil.formatTime;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import kr.xit.biz.ens.mapper.IEnsCctvFileMapper;
import kr.xit.biz.ens.model.EnsDTO;
import kr.xit.biz.ens.model.EnsDTO.EnsNtncCntcSndngTgt;
import kr.xit.core.service.AbstractService;
import kr.xit.core.support.utils.Checks;
import kr.xit.core.support.utils.DateUtils;
import kr.xit.core.support.utils.SFTPUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import static egovframework.com.cmm.util.EgovDateUtil.formatDate;
import static egovframework.com.cmm.util.EgovDateUtil.formatTime;
/**
* <pre>
* description : CCTV
@ -41,7 +40,7 @@ import static egovframework.com.cmm.util.EgovDateUtil.formatTime;
@Slf4j
@RequiredArgsConstructor
@Service
public class EnsCctvFileService extends EgovAbstractServiceImpl implements IEnsCctvFileService {
public class EnsCctvFileService extends AbstractService implements IEnsCctvFileService {
@Value("${app.ssh.host}") private String host;
@Value("${app.ssh.port}") private int port;

@ -1,26 +1,22 @@
package kr.xit.biz.pni.service;
import com.jcraft.jsch.SftpATTRS;
import com.jcraft.jsch.SftpException;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import kr.xit.biz.pni.mapper.IPniCctvFileMapper;
import kr.xit.biz.pni.model.PniDTO;
import kr.xit.core.exception.BizRuntimeException;
import kr.xit.core.service.AbstractService;
import kr.xit.core.support.utils.DateUtils;
import kr.xit.core.support.utils.SFTPUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
/**
* <pre>
* description : CCTV
@ -39,7 +35,7 @@ import java.util.Optional;
@Slf4j
@RequiredArgsConstructor
@Service
public class PniCctvFileService extends EgovAbstractServiceImpl implements IPniCctvFileService {
public class PniCctvFileService extends AbstractService implements IPniCctvFileService {
@Value("${app.ssh.host}") private String host;
@Value("${app.ssh.port}") private int port;

@ -3,8 +3,8 @@ package kr.xit.biz.sms.service;
import java.util.List;
import kr.xit.biz.ens.model.EnsDTO;
import kr.xit.biz.sms.mapper.ISmsMessageMapper;
import kr.xit.core.service.AbstractService;
import lombok.RequiredArgsConstructor;
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -25,7 +25,7 @@ import org.springframework.transaction.annotation.Transactional;
*/
@RequiredArgsConstructor
@Service
public class SmsMessageService extends EgovAbstractServiceImpl implements ISmsMessageService {
public class SmsMessageService extends AbstractService implements ISmsMessageService {
private final ISmsMessageMapper mapper;

@ -3,8 +3,8 @@ package kr.xit.core.biz.service;
import java.util.List;
import kr.xit.core.biz.mapper.ILoggingMapper;
import kr.xit.core.biz.model.LoggingDTO;
import kr.xit.core.service.AbstractService;
import lombok.extern.slf4j.Slf4j;
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
@ -27,7 +27,7 @@ import org.springframework.transaction.annotation.Transactional;
@Slf4j
@Service
public class LoggingService extends EgovAbstractServiceImpl implements ILoggingService{
public class LoggingService extends AbstractService implements ILoggingService{
private final ILoggingMapper mapper;
public LoggingService(ILoggingMapper mapper) {

@ -1,58 +0,0 @@
package egovframework.com.cmm;
import java.util.Locale;
import org.springframework.context.MessageSource;
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
/**
* MessageSource ReloadableResourceBundleMessageSource
* @author
* @since 2009.06.01
* @version 1.0
* @see
*
* <pre>
* << (Modification Information) >>
*
*
* ------- -------- ---------------------------
* 2009.03.11
*
* </pre>
*/
public class EgovMessageSource extends ReloadableResourceBundleMessageSource implements MessageSource {
private ReloadableResourceBundleMessageSource reloadableResourceBundleMessageSource;
/**
* getReloadableResourceBundleMessageSource()
* @param reloadableResourceBundleMessageSource - resource MessageSource
* @return ReloadableResourceBundleMessageSource
*/
public void setReloadableResourceBundleMessageSource(ReloadableResourceBundleMessageSource reloadableResourceBundleMessageSource) {
this.reloadableResourceBundleMessageSource = reloadableResourceBundleMessageSource;
}
/**
* getReloadableResourceBundleMessageSource()
* @return ReloadableResourceBundleMessageSource
*/
public ReloadableResourceBundleMessageSource getReloadableResourceBundleMessageSource() {
return reloadableResourceBundleMessageSource;
}
/**
*
* @param code -
* @return String
*/
public String getMessage(String code) {
return getReloadableResourceBundleMessageSource().getMessage(code, null, Locale.getDefault());
}
public String getMessage(String code, Object[] messageParam) {
return getReloadableResourceBundleMessageSource().getMessage(code, messageParam, Locale.getDefault());
}
}

@ -1,7 +1,6 @@
package egovframework.com.cmm.config;
import egovframework.com.cmm.EgovComTraceHandler;
import egovframework.com.cmm.EgovMessageSource;
import egovframework.com.cmm.ImagePaginationRenderer;
//import egovframework.com.cmm.web.EgovMultipartResolver;
import java.util.HashMap;
@ -58,16 +57,6 @@ public class EgovConfigAppCommon {
return new AntPathMatcher();
}
/**
* @return [Resource ]
*/
@Bean
public EgovMessageSource egovMessageSource() {
EgovMessageSource egovMessageSource = new EgovMessageSource();
egovMessageSource.setReloadableResourceBundleMessageSource(messageSource);
return egovMessageSource;
}
/**
* @return [LeaveaTrace ] defaultTraceHandler
*/

@ -1,9 +1,9 @@
package kr.xit.core.exception;
import egovframework.com.cmm.EgovMessageSource;
import java.util.Locale;
import kr.xit.core.consts.ErrorCode;
import kr.xit.core.spring.util.CoreSpringUtils;
import kr.xit.core.spring.util.MessageUtil;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
@ -35,7 +35,7 @@ public class BizRuntimeException extends BaseRuntimeException {
private String code;
private ErrorCode errorCode;
private static final EgovMessageSource messageSource = CoreSpringUtils.getMessageSource();
private static final MessageUtil messageUtil = CoreSpringUtils.getMessageUtil();
/**
* BizRuntimeException .
@ -78,7 +78,7 @@ public class BizRuntimeException extends BaseRuntimeException {
public static BizRuntimeException create(String code, Object[] messageParameters) {
BizRuntimeException e = new BizRuntimeException();
e.setCode(code);
e.setMessage(messageSource.getMessage(code, messageParameters));
e.setMessage(messageUtil.getMessage(code, messageParameters));
return e;
}

@ -1,4 +1,4 @@
package kr.xit.core.spring.util.error;
package kr.xit.core.exception;
import lombok.Getter;
import org.springframework.http.HttpStatus;
@ -7,8 +7,8 @@ import org.springframework.http.HttpStatus;
* <pre>
* description : WebClient 4xx :
*
* packageName : kr.xit.core.spring.util.error
* fileName : ClientError
* packageName : kr.xit.core.exception
* fileName : ClientErrorException
* author : limju
* date : 2023-05-25
* ======================================================================
@ -20,11 +20,11 @@ import org.springframework.http.HttpStatus;
* @see kr.xit.core.spring.util.ApiWebClientUtil
*/
@Getter
public class ClientError extends RuntimeException {
public class ClientErrorException extends RuntimeException {
private final HttpStatus status;
private final String body;
public ClientError(HttpStatus status, String body) {
public ClientErrorException(HttpStatus status, String body) {
this.status = status;
this.body = body;
}

@ -1,9 +1,8 @@
package kr.xit.core.spring.util.error;
package kr.xit.core.exception;
import io.netty.channel.ConnectTimeoutException;
import io.netty.handler.timeout.ReadTimeoutException;
import java.util.concurrent.ExecutionException;
import kr.xit.core.exception.BizRuntimeException;
import kr.xit.core.model.ApiResponseDTO;
import kr.xit.core.support.utils.Checks;
import org.apache.commons.lang3.StringUtils;
@ -14,7 +13,7 @@ import org.springframework.web.reactive.function.client.WebClientRequestExceptio
* <pre>
* description :
*
* packageName : kr.xit.core.spring.util.error
* packageName : kr.xit.core.exception
* fileName : ErrorParse
* author : limju
* date : 2023-06-01
@ -37,11 +36,11 @@ public class ErrorParse {
return ApiResponseDTO.error(be.getCode(), be.getMessage(), HttpStatus.BAD_REQUEST);
}
if(e instanceof ClientError ce) {
if(e instanceof ClientErrorException ce) {
return ApiResponseDTO.error(String.valueOf(ce.getStatus()), ce.getBody(), ce.getStatus());
}
if(e instanceof ServerError ce) {
if(e instanceof ServerErrorException ce) {
return ApiResponseDTO.error(String.valueOf(ce.getStatus()), ce.getBody(), ce.getStatus());
}

@ -1,4 +1,4 @@
package kr.xit.core.spring.util.error;
package kr.xit.core.exception;
import lombok.Getter;
import org.springframework.http.HttpStatus;
@ -7,8 +7,8 @@ import org.springframework.http.HttpStatus;
* <pre>
* description : WebClient 5xx :
*
* packageName : kr.xit.core.spring.util.error
* fileName : ServerError
* packageName : kr.xit.core.exception
* fileName : ServerErrorException
* author : limju
* date : 2023-05-25
* ======================================================================
@ -20,11 +20,11 @@ import org.springframework.http.HttpStatus;
* @see kr.xit.core.spring.util.ApiWebClientUtil
*/
@Getter
public class ServerError extends RuntimeException {
public class ServerErrorException extends RuntimeException {
private final HttpStatus status;
private final String body;
public ServerError(HttpStatus status, String body) {
public ServerErrorException(HttpStatus status, String body) {
this.status = status;
this.body = body;
}

@ -1,24 +1,19 @@
package kr.xit.core.spring.handler;
package kr.xit.core.exception.handler;
import java.util.Map;
import javax.servlet.Filter;
import kr.xit.core.consts.ErrorCode;
import kr.xit.core.exception.BizRuntimeException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.web.error.ErrorAttributeOptions;
import org.springframework.boot.web.servlet.error.DefaultErrorAttributes;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.WebRequest;
import kr.xit.core.consts.ErrorCode;
import kr.xit.core.exception.BizRuntimeException;
import kr.xit.core.spring.filter.ReadableRequestWrapper;
import lombok.extern.slf4j.Slf4j;
/**
* <pre>
* description : Catch class
* framework
* packageName : kr.xit.core.spring.handler
* packageName : kr.xit.core.exception.handler
* fileName : ReadableRequestWrapperFilter
* author : julim
* date : 2023-04-28

@ -1,4 +1,4 @@
package kr.xit.core.spring.handler;
package kr.xit.core.exception.handler;
import java.util.HashMap;
import java.util.Map;
@ -6,8 +6,8 @@ import java.util.NoSuchElementException;
import java.util.concurrent.CompletionException;
import javax.validation.ConstraintViolationException;
import kr.xit.core.exception.BizRuntimeException;
import kr.xit.core.exception.ErrorParse;
import kr.xit.core.model.ApiResponseDTO;
import kr.xit.core.spring.util.error.ErrorParse;
import kr.xit.core.support.utils.Checks;
import lombok.extern.slf4j.Slf4j;
import org.egovframe.rte.fdl.cmmn.exception.EgovBizException;
@ -33,7 +33,7 @@ import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExcep
* include-stacktrace: never # stacktrace
* path: '/error' # Handler
* whitelabel.enabled: true #
* packageName : kr.xit.core.spring.handler
* packageName : kr.xit.core.exception.handler
* fileName : CustomRestExceptionHandler
* author : julim
* date : 2023-04-28

@ -7,4 +7,4 @@
* @author limju
* @version 1.0
*/
package kr.xit.core.spring.handler;
package kr.xit.core.exception.handler;

@ -0,0 +1,50 @@
package kr.xit.core.service;
import javax.annotation.Resource;
import kr.xit.core.spring.util.MessageUtil;
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
/**
* org.egovframe.cloud.common.service.AbstractService
* <p>
* EgovAbstractServiceImpl .
* @Service .( )
*
* @author jaeyeolkim
* @version 1.0
*
* <pre>
* << (Modification Information) >>
*
*
* ---------- -------- ---------------------------
* 2021/07/28 jaeyeolkim
* </pre>
* @since 2021/07/28
*/
public abstract class AbstractService extends EgovAbstractServiceImpl {
@Resource(name = "messageUtil")
protected MessageUtil messageUtil;
/**
* messageSource .
*
* @param code
* @return
*/
protected String getMessage(String code) {
return messageUtil.getMessage(code);
}
/**
* messageSource .
*
* @param code
* @param args
* @return
*/
protected String getMessage(String code, Object[] args) {
return messageUtil.getMessage(code, args);
}
}

@ -0,0 +1,46 @@
package kr.xit.core.spring.config;
import java.nio.charset.StandardCharsets;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
/**
* <pre>
* description : * Spring MessageSource
*
* packageName : kr.xit.core.spring.config
* fileName : MessageSourceConfig
* author : julim
* date : 2023-04-28
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-04-28 julim
*
* </pre>
*/
@Slf4j
@Configuration
public class MessageSourceConfig {
@Value("${spring.messages.basename}")
private String[] basenames;
@Bean
public MessageSource messageSource() {
ReloadableResourceBundleMessageSource rrbms = new ReloadableResourceBundleMessageSource();
rrbms.setBasenames(basenames);
rrbms.getBasenameSet().forEach(s -> log.info("messageSource getBasename = {}", s));
rrbms.setCacheSeconds(60);
// 메세지가 없으면 기본 메세지 반환
rrbms.setUseCodeAsDefaultMessage(true);
rrbms.setDefaultEncoding(StandardCharsets.UTF_8.name());
return rrbms;
}
}

@ -1,6 +1,5 @@
package kr.xit.core.spring.config;
import egovframework.com.cmm.EgovMessageSource;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@ -18,13 +17,13 @@ import kr.xit.core.spring.config.properties.CorsProperties;
import kr.xit.core.spring.filter.LoggingFilter;
import kr.xit.core.spring.filter.ReadableRequestWrapperFilter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
import org.springframework.core.Ordered;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.xml.AbstractXmlHttpMessageConverter;
@ -70,6 +69,7 @@ import org.springframework.web.servlet.i18n.SessionLocaleResolver;
* @see ReadableRequestWrapperFilter
* @see LoggingFilter
*/
@Slf4j
@RequiredArgsConstructor
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
@ -135,10 +135,12 @@ public class WebMvcConfig implements WebMvcConfigurer {
* Post request(stream) logging
* @return
*/
@SuppressWarnings("rawtypes")
@Bean
public FilterRegistrationBean readableRequestWrapperFilter() {
ReadableRequestWrapperFilter readableRequestWrapperFilter = new ReadableRequestWrapperFilter();
//noinspection unchecked
FilterRegistrationBean bean = new FilterRegistrationBean(readableRequestWrapperFilter);
bean.setOrder(Ordered.HIGHEST_PRECEDENCE);
bean.addUrlPatterns(Constants.API_URL_PATTERNS);
@ -183,14 +185,18 @@ public class WebMvcConfig implements WebMvcConfigurer {
* </pre>
* @see EgovMessageSource
*/
@Bean
public ReloadableResourceBundleMessageSource messageSource() {
ReloadableResourceBundleMessageSource rrbms = new ReloadableResourceBundleMessageSource();
rrbms.setBasenames(basenames);
rrbms.setCacheSeconds(60);
rrbms.setDefaultEncoding(encoding);
return rrbms;
}
// @Bean
// public MessageSource messageSource() {
// ReloadableResourceBundleMessageSource rrbms = new ReloadableResourceBundleMessageSource();
// rrbms.setBasenames(basenames);
// rrbms.getBasenameSet().forEach(s -> log.info("messageSource getBasename = {}", s));
//
// rrbms.setCacheSeconds(60);
// // 메세지가 없으면 코드 메세지 load
// rrbms.setUseCodeAsDefaultMessage(true);
// rrbms.setDefaultEncoding(StandardCharsets.UTF_8.name());
// return rrbms;
// }
// -------------------------------------------------------------
// Log
@ -200,6 +206,7 @@ public class WebMvcConfig implements WebMvcConfigurer {
* app.param.log.enabled: true
* @return
*/
@SuppressWarnings("rawtypes")
@ConditionalOnProperty(value = "app.log.request.common-enabled", havingValue = "true", matchIfMissing = false)
@Bean
public FilterRegistrationBean requestLoggingFilter() {
@ -231,6 +238,7 @@ public class WebMvcConfig implements WebMvcConfigurer {
* Logging Filter
* @return FilterRegistrationBean
*/
@SuppressWarnings("rawtypes")
@ConditionalOnProperty(value = "app.log.request.filter-enabled", havingValue = "true", matchIfMissing = false)
@Bean
public FilterRegistrationBean loggingFilter() {

@ -12,8 +12,8 @@ import java.time.Duration;
import java.util.concurrent.TimeUnit;
import javax.net.ssl.SSLException;
import kr.xit.core.exception.BizRuntimeException;
import kr.xit.core.spring.util.error.ClientError;
import kr.xit.core.spring.util.error.ServerError;
import kr.xit.core.exception.ClientErrorException;
import kr.xit.core.exception.ServerErrorException;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
@ -186,11 +186,11 @@ public class WebClientConfig {
if(cr.statusCode().is4xxClientError()) {
return cr.bodyToMono(String.class)
.flatMap(errorBody -> Mono.error(new ClientError(status, errorBody)));
.flatMap(errorBody -> Mono.error(new ClientErrorException(status, errorBody)));
} else if(cr.statusCode().is5xxServerError()) {
return cr.bodyToMono(String.class)
.flatMap(errorBody -> Mono.error(new ServerError(status, errorBody)));
.flatMap(errorBody -> Mono.error(new ServerErrorException(status, errorBody)));
}
// if(log.isDebugEnabled()) {

@ -7,11 +7,11 @@ import java.util.Map;
import java.util.Objects;
import kr.xit.biz.ens.model.cmm.CmmEnsRlaybsnmDTO;
import kr.xit.core.consts.Constants;
import kr.xit.core.exception.ClientErrorException;
import kr.xit.core.exception.ErrorParse;
import kr.xit.core.exception.ServerErrorException;
import kr.xit.core.model.ApiResponseDTO;
import kr.xit.core.spring.config.support.WebClientConfig;
import kr.xit.core.spring.util.error.ClientError;
import kr.xit.core.spring.util.error.ErrorParse;
import kr.xit.core.spring.util.error.ServerError;
import kr.xit.core.support.utils.JsonUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@ -28,7 +28,7 @@ import org.springframework.web.util.UriComponentsBuilder;
/**
* <pre>
* description : react Restfull Util
* error(.onStatus) ExchangeFilterFunction {@link WebClientConfig#responseFilter responseFilter}
* error(.onStatus) ExchangeFilterFunction {@link WebClientConfig responseFilter}
* packageName : kr.xit.core.spring.util
* fileName : ApiWebClientUtil
* author : julim
@ -41,8 +41,8 @@ import org.springframework.web.util.UriComponentsBuilder;
* </pre>
* @see WebClientConfig
* @see kr.xit.core.spring.config.AsyncExecutorConfig
* @see ClientError
* @see ServerError
* @see ClientErrorException
* @see ServerErrorException
* @see ErrorParse
* @see kr.xit.core.spring.config.support.CustomJacksonConfig
*/
@ -56,10 +56,10 @@ public class ApiWebClientUtil {
/**
* WebClient GET
* (.onStatus status.is4xxClientError() || status.is5xxServerError())
* -> {@link WebClientConfig#responseFilter responseFilter}
* @param url
* @param responseDtoClass
* @param headerMap
* -> {@link WebClientConfig responseFilter}
* @param url String
* @param responseDtoClass Class<T>
* @param headerMap Map<String, String>
* @return responseDtoClass
*/
public <T> T get(final String url, final Class<T> responseDtoClass, Map<String, String> headerMap) {
@ -75,11 +75,11 @@ public class ApiWebClientUtil {
/**
* WebClient POST
* (.onStatus status.is4xxClientError() || status.is5xxServerError())
* -> {@link WebClientConfig#responseFilter responseFilter}
* @param url
* @param requestDto
* @param responseDtoClass
* @param headerMap
* -> {@link WebClientConfig responseFilter}
* @param url String
* @param requestDto V
* @param responseDtoClass Class<T>
* @param headerMap Map<String, String>
* @return responseDtoClass
*/
public <T, V> T post(final String url, final V requestDto, final Class<T> responseDtoClass, Map<String, String> headerMap) {
@ -96,13 +96,13 @@ public class ApiWebClientUtil {
/**
* kakao WebClient
* (.onStatus status.is4xxClientError() || status.is5xxServerError())
* -> {@link WebClientConfig#responseFilter responseFilter}
* @param url
* @param method
* @param body
* @param rtnClzz
* -> {@link WebClientConfig responseFilter}
* @param url String
* @param method HttpMethod
* @param body Object
* @param rtnClzz Class<T>
* @param ensDTO CmmEnsRlaybsnmDTO
* @return rtnClzz
* @return rtnClzz<T>
*/
public <T> T exchangeKko(final String url, final HttpMethod method, final Object body, final Class<T> rtnClzz, final CmmEnsRlaybsnmDTO ensDTO) {
@ -114,6 +114,17 @@ public class ApiWebClientUtil {
return exchange(url, method, body, rtnClzz, map);
}
/**
* KT-BC WebClient
* (.onStatus status.is4xxClientError() || status.is5xxServerError())
* -> {@link WebClientConfig responseFilter}
* @param url String
* @param method HttpMethod
* @param body Object
* @param rtnClzz Class<T>
* @param ensDTO CmmEnsRlaybsnmDTO
* @return rtnClzz<T>
*/
public <T> T exchangeKt(final String url, final HttpMethod method, final Object body, final Class<T> rtnClzz, final CmmEnsRlaybsnmDTO ensDTO) {
final Map<String,String> headerMap = new HashMap<>();
headerMap.put(HttpHeaders.AUTHORIZATION, String.format("%s %s", AUTH_TYPE_BEARER, ensDTO.getKtAccessToken()));
@ -128,7 +139,7 @@ public class ApiWebClientUtil {
* WebClient
* GET url (?key=value&key2=value2)
* (.onStatus status.is4xxClientError() || status.is5xxServerError())
* -> {@link WebClientConfig#responseFilter responseFilter}
* -> {@link WebClientConfig responseFilter}
* @param url call url
* @param method POST|GET
* @param body JSON String type
@ -154,7 +165,7 @@ public class ApiWebClientUtil {
* -> application/x-www-form-urlencoded
* GET url (?key=value&key2=value2)
* (.onStatus status.is4xxClientError() || status.is5xxServerError())
* -> {@link WebClientConfig#responseFilter responseFilter}
* -> {@link WebClientConfig responseFilter}
* @param url call url
* @param method POST|GET
* @param body JSON String type

@ -1,19 +1,17 @@
package kr.xit.core.spring.util;
import com.fasterxml.jackson.databind.ObjectMapper;
import egovframework.com.cmm.EgovMessageSource;
import egovframework.com.cmm.jwt.config.EgovJwtTokenUtil;
import egovframework.com.cmm.jwt.config.JwtVerification;
import kr.xit.core.spring.config.properties.CorsProperties;
import kr.xit.core.spring.config.support.ApplicationContextProvider;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.commons.configuration.PropertiesConfiguration;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.MessageSourceAccessor;
import org.springframework.context.MessageSource;
import org.springframework.core.env.Environment;
import egovframework.com.cmm.jwt.config.EgovJwtTokenUtil;
import egovframework.com.cmm.jwt.config.JwtVerification;
import kr.xit.core.spring.config.properties.CorsProperties;
import kr.xit.core.spring.config.support.ApplicationContextProvider;
/**
* <pre>
* description : Get Bean Object
@ -53,12 +51,16 @@ public class CoreSpringUtils {
*
* @return MessageSourceAccessor
*/
public static MessageSourceAccessor getMessageSourceAccessor(){
return (MessageSourceAccessor)getBean(MessageSourceAccessor.class);
public static MessageUtil getMessageUtil(){
return (MessageUtil)getBean(MessageUtil.class);
}
public static EgovMessageSource getMessageSource(){
return (EgovMessageSource)getBean(EgovMessageSource.class);
/**
*
* @return MessageSourceAccessor
*/
public static MessageSource getMessageSource(){
return (MessageSource)getBean(MessageSource.class);
}
/**

@ -0,0 +1,63 @@
package kr.xit.core.spring.util;
import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Locale;
/**
* <pre>
* description : Spring MessageSource read
*
* packageName : kr.xit.core.spring.util
* fileName : MessageUtil
* author : julim
* date : 2023-04-28
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-04-28 julim
*
* </pre>
*/
@Component
public class MessageUtil {
@Resource(name = "messageSource")
private MessageSource messageSource;
/**
* messageSource .
*
* @param code
* @return
*/
public String getMessage(String code) {
return this.getMessage(code, new Object[]{});
}
/**
* messageSource .
*
* @param code
* @param args
* @return
*/
public String getMessage(String code, Object[] args) {
return this.getMessage(code, args, LocaleContextHolder.getLocale());
}
/**
* messageSource , , .
*
* @param code
* @param args
* @param locale
* @return
*/
public String getMessage(String code, Object[] args, Locale locale) {
return messageSource.getMessage(code, args, locale);
}
}

@ -1,10 +0,0 @@
/**
* xit core java framework spring customizing package classes
* <p>
* web Client error help classes
* </p>
* @since 1.0
* @author limju
* @version 1.0
*/
package kr.xit.core.spring.util.error;
Loading…
Cancel
Save