diff --git a/src/main/java/cokr/xit/ens/core/aop/ApiResponseDTO.java b/src/main/java/cokr/xit/ens/core/aop/ApiResponseDTO.java deleted file mode 100644 index 8672a96..0000000 --- a/src/main/java/cokr/xit/ens/core/aop/ApiResponseDTO.java +++ /dev/null @@ -1,274 +0,0 @@ -package cokr.xit.ens.core.aop; - -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutionException; - -import org.springframework.http.HttpStatus; -import org.springframework.validation.BindingResult; -import org.springframework.validation.FieldError; -import org.springframework.validation.ObjectError; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonRootName; -import com.google.gson.GsonBuilder; - -import cokr.xit.ens.core.exception.BizRuntimeException; -import cokr.xit.ens.core.exception.code.ErrorCode; -import cokr.xit.ens.core.utils.Checks; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - *
- * description : Api 응답 - * TODO :: 프로젝트별 json 결과에서 제외하려면 @JsonIgnore 사용 - * packageName : kr.xit.core.model - * fileName : ApiResponseDTO - * author : julim - * date : 2023-04-28 - * ====================================================================== - * 변경일 변경자 변경 내용 - * ---------------------------------------------------------------------- - * 2023-04-28 julim 최초 생성 - * - *- */ -@Schema(name = "ApiResponseDTO", description = "Restful API 결과") -@Data -@NoArgsConstructor(access = AccessLevel.PROTECTED) -@AllArgsConstructor -@Builder -@JsonRootName("result") -@JsonInclude(JsonInclude.Include.NON_NULL) -public class ApiResponseDTO
- * description : - * - * packageName : kr.xit.core.model - * fileName : IApiResponse - * author : limju - * date : 2023-05-31 - * ====================================================================== - * 변경일 변경자 변경 내용 - * ---------------------------------------------------------------------- - * 2023-05-31 limju 최초 생성 - * - *- */ -public interface IApiResponse { -} diff --git a/src/main/java/cokr/xit/ens/core/config/support/WebClientConfig.java b/src/main/java/cokr/xit/ens/core/config/support/WebClientConfig.java deleted file mode 100644 index c159d17..0000000 --- a/src/main/java/cokr/xit/ens/core/config/support/WebClientConfig.java +++ /dev/null @@ -1,245 +0,0 @@ -package cokr.xit.ens.core.config.support; - -import java.time.Duration; -import java.util.concurrent.TimeUnit; - -import javax.net.ssl.SSLException; - -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.http.client.reactive.ReactorClientHttpConnector; -import org.springframework.http.codec.json.Jackson2JsonDecoder; -import org.springframework.http.codec.json.Jackson2JsonEncoder; -import org.springframework.web.reactive.function.client.ClientRequest; -import org.springframework.web.reactive.function.client.ClientResponse; -import org.springframework.web.reactive.function.client.ExchangeFilterFunction; -import org.springframework.web.reactive.function.client.ExchangeStrategies; -import org.springframework.web.reactive.function.client.WebClient; -import org.springframework.web.util.DefaultUriBuilderFactory; - -import com.fasterxml.jackson.databind.ObjectMapper; - -import cokr.xit.ens.core.exception.BizRuntimeException; -import cokr.xit.ens.core.exception.ClientErrorException; -import cokr.xit.ens.core.exception.ServerErrorException; -import io.netty.channel.ChannelOption; -import io.netty.handler.logging.LogLevel; -import io.netty.handler.ssl.SslContext; -import io.netty.handler.ssl.SslContextBuilder; -import io.netty.handler.ssl.util.InsecureTrustManagerFactory; -import io.netty.handler.timeout.ReadTimeoutHandler; -import io.netty.handler.timeout.WriteTimeoutHandler; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import reactor.core.publisher.Mono; -import reactor.netty.http.client.HttpClient; -import reactor.netty.resources.ConnectionProvider; -import reactor.netty.transport.logging.AdvancedByteBufFormat; - -/** - *
- * description : WebClient configuration - * Spring WebFlux 기반 HTTP Client Config - * logging : - ExchangeFilterFunction 구현 처리 가능(requestFilter, responseFilter) - * - logging.level.reactor.netty.http.client: DEBUG|ERROR - * - * packageName : kr.xit.core.spring.config.support - * fileName : WebClientConfig - * author : julim - * date : 2023-09-06 - * ====================================================================== - * 변경일 변경자 변경 내용 - * ---------------------------------------------------------------------- - * 2023-09-06 julim 최초 생성 - * - *- */ -@Slf4j -@RequiredArgsConstructor -@Configuration -public class WebClientConfig { - - @Value("${app.contract.connection.timeout:5000}") - private int connectTimeout; - @Value("${app.contract.connection.readTimeout:5000}") - private int readTimeout; - - private final ObjectMapper objectMapper; - DefaultUriBuilderFactory factory = new DefaultUriBuilderFactory(); - - /** - * setEncodingMode : GET 요청의 파라미터 셋팅을 하기 위한 URI 템플릿의 인코딩을 위한 설정 - * @return - */ - @Bean - public WebClient webClient() { - factory.setEncodingMode(DefaultUriBuilderFactory.EncodingMode.VALUES_ONLY); - - return WebClient.builder() - .defaultHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) - .uriBuilderFactory(factory) - .clientConnector(new ReactorClientHttpConnector(defaultHttpClient())) - .codecs(configurer -> configurer.defaultCodecs().maxInMemorySize(2 * 1024 * 1024)) - .exchangeStrategies(defaultExchangeStrategies()) - .filters(exchangeFilterFunctions -> { - //exchangeFilterFunctions.add(requestFilter()); - exchangeFilterFunctions.add(responseFilter()); - }) - .build(); - } - - /** - *
- * Http client 생성 - * - 요청 / 응답 debugging을 위해 wiretap 설정 - AdvancedByteBufFormat.TEXTUAL - * @return HttpClient - *- */ - @Bean - public HttpClient defaultHttpClient() { - try { - // SSL check bypass - SslContext sslContext = SslContextBuilder - .forClient() - .trustManager(InsecureTrustManagerFactory.INSTANCE) - .build(); - - return HttpClient.create(connectionProvider()) - .secure(t -> t.sslContext(sslContext)) - .wiretap(this.getClass().getCanonicalName(), LogLevel.DEBUG, - AdvancedByteBufFormat.TEXTUAL) - .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, connectTimeout) - .responseTimeout(Duration.ofMillis(this.connectTimeout)) - .doOnConnected(conn -> - conn.addHandlerLast(new ReadTimeoutHandler(readTimeout, TimeUnit.MILLISECONDS)) - .addHandlerLast( - new WriteTimeoutHandler(readTimeout, TimeUnit.MILLISECONDS))); - }catch(SSLException se){ - throw BizRuntimeException.create(se.getMessage()); - } - } - - /** - * maxConnections : connection pool의 갯수 - * pendingAcquireTimeout : 커넥션 풀에서 커넥션을 얻기 위해 기다리는 최대 시간 - * pendingAcquireMaxCount : 커넥션 풀에서 커넥션을 가져오는 시도 횟수 (-1: no limit) - * maxIdleTime : 커넥션 풀에서 idle 상태의 커넥션을 유지하는 시간 - * @return ConnectionProvider - */ - @Bean - public ConnectionProvider connectionProvider() { - return ConnectionProvider.builder("http-pool") - .maxConnections(100) - .pendingAcquireTimeout(Duration.ofMillis(0)) - .pendingAcquireMaxCount(-1) - .maxIdleTime(Duration.ofMillis(2000L)) - .build(); - } - - /** - *
- * 1. 256KB 보다 큰 HTTP 메시지를 처리 시도 → DataBufferLimitException 에러 발생 방어 - * 2. messageWriters를 통한 logging(setEnableLoggingRequestDetails(true) - * -> org.springframework.web.reactive.function.client.ExchangeFunctions: DEBUG 하여 활성 - * -> defaultHttpClient()의 wiretap 사용으로 비활성 - *- * @return ExchangeStrategies - */ - @Bean - public ExchangeStrategies defaultExchangeStrategies() { - // 256KB 보다 큰 HTTP 메시지를 처리 시도 → DataBufferLimitException 에러 발생 방어 - return ExchangeStrategies.builder() - .codecs(config -> { - config.defaultCodecs().maxInMemorySize(2 * 1024 * 1024); - config.defaultCodecs().jackson2JsonEncoder(new Jackson2JsonEncoder(objectMapper, MediaType.APPLICATION_JSON)); - config.defaultCodecs().jackson2JsonDecoder(new Jackson2JsonDecoder(objectMapper, MediaType.APPLICATION_JSON)); - }) - .build(); - -// es.messageWriters() -// .stream() -// .filter(LoggingCodecSupport.class::isInstance) -// .forEach(writer -> ((LoggingCodecSupport)writer).setEnableLoggingRequestDetails(true)); - } - - private ExchangeFilterFunction requestFilter() { - return ExchangeFilterFunction.ofRequestProcessor(cr -> { - if (log.isDebugEnabled()) { - StringBuilder sb = new StringBuilder("\n>>>>>>>>>> WebClient Http Request <<<<<<<<<<<<<\n"); - sb.append(logMethodAndUrl(cr)); - sb.append(logHeaders(cr)); - sb.append("-------------------------------------------------------"); - log.debug(sb.toString()); - } - return Mono.just(cr); - }); - } - - /** - * reponse logging && error Handling - * @return ExchangeFilterFunction - */ - private ExchangeFilterFunction responseFilter() { - return ExchangeFilterFunction.ofResponseProcessor(cr -> { - - HttpStatus status = cr.statusCode(); - - if(cr.statusCode().is4xxClientError()) { - return cr.bodyToMono(String.class) - .flatMap(errorBody -> Mono.error(new ClientErrorException(status, errorBody))); - - } else if(cr.statusCode().is5xxServerError()) { - return cr.bodyToMono(String.class) - .flatMap(errorBody -> Mono.error(new ServerErrorException(status, errorBody))); - } - -// if(log.isDebugEnabled()) { -// StringBuilder sb = new StringBuilder( -// "\n>>>>>>>>>> WebClient Http Response <<<<<<<<<<<<<\n"); -// sb.append(logStatus(cr)); -// sb.append(logHeaders(cr)); -// sb.append("-------------------------------------------------------"); -// log.debug(sb.toString()); -// } - return Mono.just(cr); - }); - } - - private static String logStatus(ClientResponse response) { - HttpStatus status = response.statusCode(); - return String.format("Returned staus code %s (%s)", status.value(), status.getReasonPhrase()); - } - - private static String logHeaders(ClientRequest request) { - StringBuilder sb = new StringBuilder(); - - request.headers() - .forEach((name, values) -> - values.forEach(value -> sb.append(name).append(": ").append(value).append("\n")) - ); - return sb.toString(); - } - - private static String logHeaders(ClientResponse response) { - StringBuilder sb = new StringBuilder(); - response.headers() - .asHttpHeaders() - .forEach((name, values) -> - values.forEach(value -> sb.append(name).append(": ").append(value).append("\n")) - ); - return sb.toString(); - } - - private static String logMethodAndUrl(ClientRequest request) { - StringBuilder sb = new StringBuilder(); - sb.append(request.method().name()); - sb.append(" to "); - sb.append(request.url()); - - return sb.append("\n").toString(); - } -} diff --git a/src/main/java/cokr/xit/ens/core/exception/ClientErrorException.java b/src/main/java/cokr/xit/ens/core/exception/ClientErrorException.java deleted file mode 100644 index 8f1a5dc..0000000 --- a/src/main/java/cokr/xit/ens/core/exception/ClientErrorException.java +++ /dev/null @@ -1,33 +0,0 @@ -package cokr.xit.ens.core.exception; - -import org.springframework.http.HttpStatus; - -import cokr.xit.ens.core.utils.ApiWebClientUtil; -import lombok.Getter; - -/** - *
- * description : WebClient 4xx 에러 : 에러 핸들러에서 사용 - * - * packageName : kr.xit.core.exception - * fileName : ClientErrorException - * author : limju - * date : 2023-05-25 - * ====================================================================== - * 변경일 변경자 변경 내용 - * ---------------------------------------------------------------------- - * 2023-05-25 limju 최초 생성 - * - *- * @see ApiWebClientUtil - */ -@Getter -public class ClientErrorException extends RuntimeException { - private final HttpStatus status; - private final String body; - - public ClientErrorException(HttpStatus status, String body) { - this.status = status; - this.body = body; - } -} diff --git a/src/main/java/cokr/xit/ens/core/exception/ErrorParse.java b/src/main/java/cokr/xit/ens/core/exception/ErrorParse.java deleted file mode 100644 index 6e0d69e..0000000 --- a/src/main/java/cokr/xit/ens/core/exception/ErrorParse.java +++ /dev/null @@ -1,99 +0,0 @@ -package cokr.xit.ens.core.exception; - -import java.util.concurrent.ExecutionException; - -import org.apache.commons.lang3.StringUtils; -import org.springframework.http.HttpStatus; -import org.springframework.web.reactive.function.client.WebClientRequestException; - -import cokr.xit.ens.core.aop.ApiResponseDTO; -import cokr.xit.ens.core.utils.Checks; -import io.netty.channel.ConnectTimeoutException; -import io.netty.handler.timeout.ReadTimeoutException; - - -/** - *
- * description : - * - * packageName : kr.xit.core.exception - * fileName : ErrorParse - * author : limju - * date : 2023-06-01 - * ====================================================================== - * 변경일 변경자 변경 내용 - * ---------------------------------------------------------------------- - * 2023-06-01 limju 최초 생성 - * - *- */ -public class ErrorParse { - - @SuppressWarnings("rawtypes") - public static ApiResponseDTO extractError(final Throwable e){ - String errCode = String.valueOf(HttpStatus.INTERNAL_SERVER_ERROR.value()); - String message = Checks.isNotNull(e) ? e.getLocalizedMessage() : StringUtils.EMPTY; - HttpStatus httpStatus = null; - - if(e instanceof BizRuntimeException) { - BizRuntimeException be = (BizRuntimeException) e; - return ApiResponseDTO.error(be.getCode(), be.getMessage(), HttpStatus.BAD_REQUEST); - } - - if(e instanceof ClientErrorException) { - ClientErrorException ce = (ClientErrorException) e; - return ApiResponseDTO.error(String.valueOf(ce.getStatus()), ce.getBody(), ce.getStatus()); - } - - if(e instanceof ServerErrorException) { - ServerErrorException ce = (ServerErrorException) e; - return ApiResponseDTO.error(String.valueOf(ce.getStatus()), ce.getBody(), ce.getStatus()); - } - - // Async(React) Exception 처리 - if(e instanceof WebClientRequestException) { - if (e.getCause() instanceof ConnectTimeoutException || e.getCause() instanceof ReadTimeoutException) { - return getTimeoutException(); - } - } - - if(e instanceof ExecutionException) { - if (e.getCause() instanceof WebClientRequestException) { - message = e.getCause().getMessage(); - - // Timeout 에러 - if (e.getCause().getCause() instanceof ReadTimeoutException || e.getCause().getCause() instanceof ConnectTimeoutException) { - return getTimeoutException(); - } - } - } - - if(e instanceof ReadTimeoutException){ - return getTimeoutException(); - } - - // Async(React) Exception 처리 - if(e.getCause() instanceof WebClientRequestException){ - - // Timeout 에러 - if(e.getCause().getCause() instanceof ReadTimeoutException){ - return getTimeoutException(); - } - - } - - if(Checks.isNotEmpty(e.getCause())) { - message = e.getCause().getMessage(); - } - - return ApiResponseDTO.error(errCode, message, httpStatus); - } - - @SuppressWarnings("rawtypes") - private static ApiResponseDTO getTimeoutException(){ - return ApiResponseDTO.error( - String.valueOf(HttpStatus.REQUEST_TIMEOUT.value()), - HttpStatus.REQUEST_TIMEOUT.getReasonPhrase(), - HttpStatus.REQUEST_TIMEOUT); - } -} diff --git a/src/main/java/cokr/xit/ens/core/exception/ServerErrorException.java b/src/main/java/cokr/xit/ens/core/exception/ServerErrorException.java deleted file mode 100644 index 36364bf..0000000 --- a/src/main/java/cokr/xit/ens/core/exception/ServerErrorException.java +++ /dev/null @@ -1,33 +0,0 @@ -package cokr.xit.ens.core.exception; - -import org.springframework.http.HttpStatus; - -import cokr.xit.ens.core.utils.ApiWebClientUtil; -import lombok.Getter; - -/** - *
- * description : WebClient 5xx 에러 : 에러 핸들러에서 사용 - * - * packageName : kr.xit.core.exception - * fileName : ServerErrorException - * author : limju - * date : 2023-05-25 - * ====================================================================== - * 변경일 변경자 변경 내용 - * ---------------------------------------------------------------------- - * 2023-05-25 limju 최초 생성 - * - *- * @see ApiWebClientUtil - */ -@Getter -public class ServerErrorException extends RuntimeException { - private final HttpStatus status; - private final String body; - - public ServerErrorException(HttpStatus status, String body) { - this.status = status; - this.body = body; - } -} diff --git a/src/main/java/cokr/xit/ens/core/utils/ApiWebClientUtil.java b/src/main/java/cokr/xit/ens/core/utils/ApiWebClientUtil.java deleted file mode 100644 index 0b9cbe9..0000000 --- a/src/main/java/cokr/xit/ens/core/utils/ApiWebClientUtil.java +++ /dev/null @@ -1,253 +0,0 @@ -package cokr.xit.ens.core.utils; - -import java.net.URI; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang3.ObjectUtils; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpMethod; -import org.springframework.http.MediaType; -import org.springframework.http.client.MultipartBodyBuilder; -import org.springframework.stereotype.Component; -import org.springframework.web.multipart.MultipartFile; -import org.springframework.web.reactive.function.BodyInserters; -import org.springframework.web.util.UriComponentsBuilder; - -import cokr.xit.ens.core.aop.ApiResponseDTO; -import cokr.xit.ens.core.config.support.WebClientConfig; -import cokr.xit.ens.core.exception.ClientErrorException; -import cokr.xit.ens.core.exception.ErrorParse; -import cokr.xit.ens.modules.kkotalk.model.CmmEnsRlaybsnmDTO; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; - -/** - *
- * description : react Restfull Util - * error(.onStatus)는 ExchangeFilterFunction {@link WebClientConfig responseFilter} 에서 처리 - * packageName : kr.xit.core.spring.util - * fileName : ApiWebClientUtil - * author : julim - * date : 2023-09-06 - * ====================================================================== - * 변경일 변경자 변경 내용 - * ---------------------------------------------------------------------- - * 2023-09-06 julim 최초 생성 - * - *- * @see WebClientConfig - * @see kr.xit.core.spring.config.AsyncExecutorConfig - * @see ClientErrorException - * @see ServerErrorException - * @see ErrorParse - * @see kr.xit.core.spring.config.support.CustomJacksonConfig - */ -@Slf4j -@Component -@RequiredArgsConstructor -public class ApiWebClientUtil { - private static final String AUTH_TYPE_BEARER = "bearer"; - private final WebClientConfig webClientConfig; - - /** - * WebClient GET 호출 처리 - * 에러(.onStatus status.is4xxClientError() || status.is5xxServerError()) - * -> {@link WebClientConfig responseFilter} 에서 처리 - * @param url String - * @param responseDtoClass Class
- * WebClient 호출 처리 - * GET 요청시 url에 파라메터를 포함해야 함(?key=value&key2=value2) - * 에러(.onStatus status.is4xxClientError() || status.is5xxServerError()) - * -> {@link WebClientConfig responseFilter} 에서 처리 - * @param url call url - * @param method POST|GET - * @param body JSON String type - * @param rtnClzz rtnClzz return type class - * (ex: new KkopayDocDTO.DocStatusResponse().getClass()) - * @return T rtnClzz return DTO - *- */ - public
- * WebClient form data 호출 처리 - * -> application/x-www-form-urlencoded 전송시 - * GET 요청시 url에 파라메터를 포함해야 함(?key=value&key2=value2) - * 에러(.onStatus status.is4xxClientError() || status.is5xxServerError()) - * -> {@link WebClientConfig responseFilter} 에서 처리 - * @param url call url - * @param method POST|GET - * @param body JSON String type - * @param rtnClzz rtnClzz return type class - * (ex: new KkopayDocDTO.DocStatusResponse().getClass()) - * @return T rtnClzz return DTO - *- */ - public
-// * description : ENS 공통 method -// * -// * packageName : kr.xit.ens.cmm -// * fileName : CmmNiceCiUtils -// * author : limju -// * date : 2023-09-19 -// * ====================================================================== -// * 변경일 변경자 변경 내용 -// * ---------------------------------------------------------------------- -// * 2023-09-19 limju 최초 생성 -// * -// *-// */ -// -// @NoArgsConstructor(access = AccessLevel.PRIVATE) -// public class CmmEnsUtils { -// private static final MessageUtil messageUtil = CoreSpringUtils.getMessageUtil(); -// private static final ICmmEnsCacheService cacheService = ApiSpringUtils.getCmmEnsCacheService(); -// private static final IBizKtBcService bizKtService = ApiSpringUtils.getBizKtMmsService(); -// -// /** -// * 문서 중개자 인증 정보 조회 -// * @param signguCode string -// * @param ffnlgCode String -// * @param seCode SndngSeCode 문서중개자 구분 코드 -// * @return CmmEnsRlaybsnmDTO 문서중개자 정보 -// */ -// public static CmmEnsRlaybsnmDTO getRlaybsnmInfo(final String signguCode, final String ffnlgCode, final -// SndngSeCode seCode) { -// CmmEnsRequestDTO ensDTO = CmmEnsRequestDTO.builder() -// .signguCode(signguCode) -// .ffnlgCode(ffnlgCode) -// .profile(ApiConstants.IS_PROFILE_LOCAL? "local" : "prod") -// .build(); -// -// final CmmEnsRlaybsnmDTO dto = cacheService.getRlaybsnmInfoCache(ensDTO); -// if(ObjectUtils.isEmpty(dto)) throw BizRuntimeException.create(messageUtil.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 -// && ObjectUtils.isNotEmpty(dto.getKtAccessToken()) -// ) return dto; -// -// // 유효기간이 경과된 경우 재발급 -// bizKtService.requestToken( -// KtMnsRequest.builder() -// .signguCode(signguCode) -// .ffnlgCode(ffnlgCode) -// .profile(ApiConstants.IS_PROFILE_LOCAL? "local" : "prod") -// .build() -// ); -// return cacheService.getRlaybsnmInfoCache(ensDTO); -// } -// return dto; -// } -// -// /** -// *
-// * parameter validation check -// * invalid parameter message -> String으로 BizRuntimeException throw -// * @param t T -// *-// */ -// public static
-// * AES 암호화 -> Base64 encoding return -// * -> Nice ci 데이타 암호화 -// * -// * @param key String -// * @param iv String -// * @param planText String -// * @return String Base64 encoding data -// *-// */ -// public static String encodeAesData(final String key, final String iv, final String planText) { -// final SecretKey secureKey = new SecretKeySpec(key.getBytes(), "AES"); -// try { -// final Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); -// cipher.init(Cipher.ENCRYPT_MODE, secureKey, new IvParameterSpec(iv.getBytes())); -// -// final byte[] encData = cipher.doFinal(planText.trim().getBytes(StandardCharsets.UTF_8)); -// return Base64.getEncoder().encodeToString(encData); -// -// }catch (NoSuchPaddingException | NoSuchAlgorithmException | -// InvalidAlgorithmParameterException | InvalidKeyException | -// IllegalBlockSizeException | BadPaddingException e){ -// throw BizRuntimeException.create(e.getMessage()); -// } -// } -// -// /** -// *
-// * Hmac 무결성체크값(integrity_value) 생성 -// * @param hmacKey String -// * @param message String -// * @return String -// *-// */ -// public static String encodeHmacSha256(final String hmacKey, final String message) { -// try { -// final Mac mac = Mac.getInstance("HmacSHA256"); -// final SecretKeySpec sks = new SecretKeySpec(hmacKey.getBytes(), "HmacSHA256"); -// mac.init(sks); -// final byte[] hmac256 = mac.doFinal(message.getBytes()); -// return Base64.getEncoder().encodeToString(hmac256); -// -// }catch (NoSuchAlgorithmException|InvalidKeyException e){ -// throw BizRuntimeException.create(e.getMessage()); -// } -// } -// -// /** -// * AES 복호화 -// * @param encData String -// * @param key String -// * @param iv String -// * @return String -// */ -// public static String decodeAesData(String encData, String key, String iv) { -// -// final byte[] respDataEnc = Base64.getDecoder().decode(encData.getBytes()); -// final SecretKey secureKey = new SecretKeySpec(key.getBytes(), "AES"); -// -// try { -// final Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); -// cipher.init(Cipher.DECRYPT_MODE, secureKey, new IvParameterSpec(iv.getBytes())); -// final byte[] decrypted = cipher.doFinal(respDataEnc); -// return new String(decrypted); -// -// }catch (NoSuchPaddingException | NoSuchAlgorithmException | -// InvalidAlgorithmParameterException | InvalidKeyException | -// IllegalBlockSizeException | BadPaddingException e){ -// throw BizRuntimeException.create(e.getMessage()); -// } -// } -// } diff --git a/src/main/java/cokr/xit/ens/modules/kkotalk/model/CmmEnsRequestDTO.java b/src/main/java/cokr/xit/ens/modules/kkotalk/model/CmmEnsRequestDTO.java deleted file mode 100644 index 898cefa..0000000 --- a/src/main/java/cokr/xit/ens/modules/kkotalk/model/CmmEnsRequestDTO.java +++ /dev/null @@ -1,67 +0,0 @@ -package cokr.xit.ens.modules.kkotalk.model; - -import javax.validation.constraints.Size; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.annotation.JsonProperty; - -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.media.Schema.RequiredMode; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.experimental.SuperBuilder; - -/** - *
- * description : 전자고지 문서중계자 Request 공통 DTO - * - * packageName : kr.xit.biz.ens.model.kt - * fileName : CmmEnsRequestDTO - * author : limju - * date : 2023-09-22 - * ====================================================================== - * 변경일 변경자 변경 내용 - * ---------------------------------------------------------------------- - * 2023-09-22 limju 최초 생성 - * - *- */ -@Data -@NoArgsConstructor -@AllArgsConstructor -@SuperBuilder -@JsonInclude(Include.NON_NULL) -public class CmmEnsRequestDTO { - - /** - * 시군구 코드 - */ - @Schema(requiredMode = RequiredMode.REQUIRED, title = "시군구코드", example = "51110") - @Size(min = 1, max = 10, message = "시군구 코드는 필수 입니다") - @JsonProperty("signguCode") - private String signguCode; - - /** - * 과태료 코드 - */ - @Schema(requiredMode = RequiredMode.REQUIRED, title = "과태료코드", example = "11") - @Size(min = 1, max = 2, message = "과태료 코드는 필수 입니다") - @JsonProperty("ffnlgCode") - private String ffnlgCode = "11"; - - /** - * active profile - */ - @Schema(requiredMode = RequiredMode.AUTO, title = "profile", example = "local") - @JsonProperty("profile") - private String profile; - - /** - * 1차 발송 - */ - @Schema(hidden = true, requiredMode = RequiredMode.AUTO, title = "1차 발송", example = "KKO-MY-DOC") - @JsonProperty("try1") - private String try1; -} diff --git a/src/main/java/cokr/xit/ens/modules/kkotalk/model/CmmEnsRlaybsnmDTO.java b/src/main/java/cokr/xit/ens/modules/kkotalk/model/CmmEnsRlaybsnmDTO.java deleted file mode 100644 index 568ec56..0000000 --- a/src/main/java/cokr/xit/ens/modules/kkotalk/model/CmmEnsRlaybsnmDTO.java +++ /dev/null @@ -1,174 +0,0 @@ -package cokr.xit.ens.modules.kkotalk.model; - -import java.io.Serializable; -import java.time.LocalDateTime; - -import com.fasterxml.jackson.annotation.JsonFormat; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - *
- * description : 전자고지 문서중계자 정보 DTO - * - * packageName : kr.xit.biz.ens.model.kt - * fileName : KtMmsDTO - * author : limju - * date : 2023-09-22 - * ====================================================================== - * 변경일 변경자 변경 내용 - * ---------------------------------------------------------------------- - * 2023-09-22 limju 최초 생성 - * - *- */ -@Data -@NoArgsConstructor -@AllArgsConstructor -@Builder -public class CmmEnsRlaybsnmDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * 시군구 코드 - */ - private String signguCode; - /** - * 과태료 코드 - */ - private String ffnlgCode; - /** - * profile - */ - private String profile; - /** - * 시군구 명 - */ - private String signguNm; - /** - * 과태료 명 - */ - private String ffnlgNm; - /** - * KAKAO CLIENT ID - */ - private String kakaoClientId; - /** - * KAKAO 상품 코드 - */ - private String kakaoProductCd; - /** - * KAKAO ACCESS TOKEN - */ - private String kakaoAccessToken; - /** - * KAKAO CONTRACT UUID - */ - private String kakaoContractUuid; - /** - * KAKAO_NEW PARTNER KEY - */ - private String kakaoPartnerRestApiKey; - /** - * KAKAO_NEW DEALER KEY - */ - private String kakaoDealerRestApiKey; - /** - * KAKAO_NEW SETTLE ID - */ - private String kakaoSettleId; - /** - * KT client id - */ - private String ktClientId; - /** - * KT client tp - */ - private String ktClientTp; - /** - * KT Scope - */ - private String ktScope; - /** - * KT Service code - */ - private String ktServiceCode; - /** - * KT service client ID - */ - private String ktSvcClientId; - /** - * KT service client secret - */ - private String ktSvcClientSecret; - /** - * KT service cerf key - */ - private String ktSvcCerfKey; - /** - * KT_ACCESS_TOKEN - */ - private String ktAccessToken; - - /** - * KT 토큰 유효 기간 - */ - private String ktTokenExpiresIn; - /** - * KT 토큰 식별자 - */ - private String ktTokenJti; - /** - * postplus apiKey - */ - private String pplusApiKey; - - /** - * EPost service key - */ - private String epostServiceKey; - - /** - * 발송인 명 - */ - private String senderNm; - /** - * 발송인 우편번호 - */ - private String senderZipNo; - /** - * 발송인 주소 - */ - private String senderAddr; - /** - * 발송인 상세 주소 - */ - private String senderDetailAddr; - - /** - * 등록 일시 - */ - @JsonDeserialize(using = LocalDateDeserializer.class) - @JsonFormat(pattern = "yyyy-MM-dd kk:mm:ss") - private LocalDateTime registDt; - /** - * 등록자 - */ - private String register; - /** - * 수정 일시 - */ - @JsonDeserialize(using = LocalDateDeserializer.class) - @JsonFormat(pattern = "yyyy-MM-dd kk:mm:ss") - private LocalDateTime updtDt; - /** - * 수정자 - */ - private String updusr; -}