From 65fdc2c9ff6fb37bc501624e5ad07a23554666c9 Mon Sep 17 00:00:00 2001 From: limju Date: Thu, 9 Nov 2023 11:08:05 +0900 Subject: [PATCH] feat: ssl bypass add --- .../xit/biz/kt/service/BizKtMmsService.java | 264 ------------------ .../biz/sisul/service/BizSisulService.java | 14 +- .../config/support/HttpsConnectorConfig.java | 11 +- .../handler/CustomRestExceptionHandler.java | 18 +- 4 files changed, 25 insertions(+), 282 deletions(-) diff --git a/mens-api/src/main/java/kr/xit/biz/kt/service/BizKtMmsService.java b/mens-api/src/main/java/kr/xit/biz/kt/service/BizKtMmsService.java index 11244db..fd6341f 100644 --- a/mens-api/src/main/java/kr/xit/biz/kt/service/BizKtMmsService.java +++ b/mens-api/src/main/java/kr/xit/biz/kt/service/BizKtMmsService.java @@ -141,268 +141,4 @@ public class BizKtMmsService extends EgovAbstractServiceImpl implements IBizKtMm .errors(errors) .build(); } - -// /** -// * 사전 문자 수신 등록 요청(BC-AG-SN-001) -// * @param reqDTO -// */ -// @Override -// public KtCommonResponse beforeSend(final KtBefSendRequest reqDTO) { -// final CmmEnsRlaybsnmDTO ktMnsInfo = CmmKtMmsUtils.getRlaybsnmInfo(reqDTO.getSignguCode(), reqDTO.getFfnlgCode()); -// //reqDTO.setServiceCd(ktMnsInfo.get); -// //reqDTO.setServiceKey(ktMnsInfo.get); -// CmmEnsUtils.validate(reqDTO); -// -// return webClient.exchangeKt( -// HOST + API_BEFORE_SEND, -// HttpMethod.POST, -// JsonUtils.toJson(reqDTO), -// KtCommonResponse.class, -// ktMnsInfo -// ); -// -// /*List errors = new ArrayList<>(); -// errors.add(new ErrorMsg("error1")); -// errors.add(new ErrorMsg("error2")); -// -// return KtCommonResponse.builder() -// .resultCd("00") -// .resultDt(DateUtils.getTodayAndNowTime(ApiConstants.FMT_DT_EMPTY_DLT)) -// .errors(errors) -// .build();*/ -// } -// -// @Override -// public KtCommonResponse mainSend(final KtMainSendRequest reqDTO) { -// final CmmEnsRlaybsnmDTO ktMnsInfo = CmmKtMmsUtils.getRlaybsnmInfo(reqDTO.getSignguCode(), reqDTO.getFfnlgCode()); -// //reqDTO.setServiceCd(ktMnsInfo.get); -// //reqDTO.setServiceKey(ktMnsInfo.get); -// CmmEnsUtils.validate(reqDTO); -// -// return webClient.exchangeKt( -// HOST + API_MAIN_SEND, -// HttpMethod.POST, -// JsonUtils.toJson(reqDTO), -// KtCommonResponse.class, -// ktMnsInfo -// ); -// } -// -// @Override -// public KtCommonResponse blacklist(final KtBlacklistRequest reqDTO) { -// final CmmEnsRlaybsnmDTO ktMnsInfo = CmmKtMmsUtils.getRlaybsnmInfo(reqDTO.getSignguCode(), reqDTO.getFfnlgCode()); -// //reqDTO.setServiceCd(ktMnsInfo.get); -// //reqDTO.setServiceKey(ktMnsInfo.get); -// CmmEnsUtils.validate(reqDTO); -// -// return webClient.exchangeKt( -// HOST + API_BLACKLIST, -// HttpMethod.POST, -// JsonUtils.toJson(reqDTO), -// KtCommonResponse.class, -// ktMnsInfo -// ); -// } -// -// @Override -// public KtCommonResponse cfmToken(final KtTokenDTO.KtTokenConfirmRequest reqDTO) { -// final CmmEnsRlaybsnmDTO ktMnsInfo = CmmKtMmsUtils.getRlaybsnmInfo(reqDTO.getSignguCode(), reqDTO.getFfnlgCode()); -// //reqDTO.setServiceCd(ktMnsInfo.get); -// //reqDTO.setServiceKey(ktMnsInfo.get); -// CmmEnsUtils.validate(reqDTO); -// -// return webClient.exchangeKt( -// HOST + API_CFM_TOKEN, -// HttpMethod.POST, -// JsonUtils.toJson(reqDTO), -// KtCommonResponse.class, -// ktMnsInfo -// ); -// } -// -// @Override -// public KtCommonResponse readToken(final KtTokenReadRequest reqDTO) { -// final CmmEnsRlaybsnmDTO ktMnsInfo = CmmKtMmsUtils.getRlaybsnmInfo(reqDTO.getSignguCode(), reqDTO.getFfnlgCode()); -// //reqDTO.setServiceCd(ktMnsInfo.get); -// //reqDTO.setServiceKey(ktMnsInfo.get); -// CmmEnsUtils.validate(reqDTO); -// -// return webClient.exchangeKt( -// HOST + API_READ_TOKEN, -// HttpMethod.POST, -// JsonUtils.toJson(reqDTO), -// KtCommonResponse.class, -// ktMnsInfo -// ); -// } -// -// @Override -// public KtCommonResponse messageResult(final KtMsgRsltRequest reqDTO) { -// final CmmEnsRlaybsnmDTO ktMnsInfo = CmmKtMmsUtils.getRlaybsnmInfo(reqDTO.getSignguCode(), reqDTO.getFfnlgCode()); -// //reqDTO.setServiceCd(ktMnsInfo.get); -// //reqDTO.setServiceKey(ktMnsInfo.get); -// CmmEnsUtils.validate(reqDTO); -// -// return webClient.exchangeKt( -// HOST + API_RESULT_MESSAGE, -// HttpMethod.POST, -// JsonUtils.toJson(reqDTO), -// KtCommonResponse.class, -// ktMnsInfo -// ); -// } -// -// @Override -// public KtSendSttcResponse sendSttc(final KtSendSttcRequest reqDTO) { -// final CmmEnsRlaybsnmDTO ktMnsInfo = CmmKtMmsUtils.getRlaybsnmInfo(reqDTO.getSignguCode(), reqDTO.getFfnlgCode()); -// //reqDTO.setServiceCd(ktMnsInfo.get); -// //reqDTO.setServiceKey(ktMnsInfo.get); -// CmmEnsUtils.validate(reqDTO); -// -// return webClient.exchangeKt( -// HOST + API_SEND_STTC, -// HttpMethod.POST, -// JsonUtils.toJson(reqDTO), -// KtSendSttcResponse.class, -// ktMnsInfo -// ); -// } -// -// @Override -// public KtSendSttcDtlResponse sendSttcDtl(final KtSendSttcDtlRequest reqDTO) { -// final CmmEnsRlaybsnmDTO ktMnsInfo = CmmKtMmsUtils.getRlaybsnmInfo(reqDTO.getSignguCode(), reqDTO.getFfnlgCode()); -// //reqDTO.setServiceCd(ktMnsInfo.get); -// //reqDTO.setServiceKey(ktMnsInfo.get); -// CmmEnsUtils.validate(reqDTO); -// -// return webClient.exchangeKt( -// HOST + API_SEND_STTCDTL, -// HttpMethod.POST, -// JsonUtils.toJson(reqDTO), -// KtSendSttcDtlResponse.class, -// ktMnsInfo -// ); -// } -// -// @Override -// public KtCommonResponse whitelist(final KtWhitelistRequest reqDTO) { -// final CmmEnsRlaybsnmDTO ktMnsInfo = CmmKtMmsUtils.getRlaybsnmInfo(reqDTO.getSignguCode(), reqDTO.getFfnlgCode()); -// //reqDTO.setServiceCd(ktMnsInfo.get); -// //reqDTO.setServiceKey(ktMnsInfo.get); -// CmmEnsUtils.validate(reqDTO); -// -// return webClient.exchangeKt( -// HOST + API_WHITELIST, -// HttpMethod.POST, -// JsonUtils.toJson(reqDTO), -// KtCommonResponse.class, -// ktMnsInfo -// ); -// } -// -// @Override -// public KtCommonResponse refuseRcv(final KtRefuseRcvRequest reqDTO) { -// //final CmmEnsRlaybsnmDTO ktMnsInfo = CmmKtMmsUtils.getRlaybsnmInfo(reqDTO.getSignguCode(), reqDTO.getFfnlgCode()); -// //reqDTO.setServiceCd(ktMnsInfo.get); -// //reqDTO.setServiceKey(ktMnsInfo.get); -// CmmEnsUtils.validate(reqDTO); -// -// return KtCommonResponse.builder() -// .resultCd("") -// .resultDt("") -// .build(); -// } -// -// @Override -// public KtCommonResponse approveRcv(final KtApproveRcvRequest reqDTO) { -// //final CmmEnsRlaybsnmDTO ktMnsInfo = CmmKtMmsUtils.getRlaybsnmInfo(reqDTO.getSignguCode(), reqDTO.getFfnlgCode()); -// //reqDTO.setServiceCd(ktMnsInfo.get); -// //reqDTO.setServiceKey(ktMnsInfo.get); -// CmmEnsUtils.validate(reqDTO); -// -// return KtCommonResponse.builder() -// .resultCd("") -// .resultDt("") -// .build(); -// } -// -// @Override -// public KtAcmdCerfResponse cerfAcmd(final KtAcmdCerfRequest reqDTO) { -// final CmmEnsRlaybsnmDTO ktMnsInfo = CmmKtMmsUtils.getRlaybsnmInfo(reqDTO.getSignguCode(), reqDTO.getFfnlgCode()); -// //reqDTO.setServiceCd(ktMnsInfo.get); -// //reqDTO.setServiceKey(ktMnsInfo.get); -// CmmEnsUtils.validate(reqDTO); -// -// return webClient.exchangeKt( -// HOST + API_CERF_ACMD, -// HttpMethod.POST, -// JsonUtils.toJson(reqDTO), -// KtAcmdCerfResponse.class, -// ktMnsInfo -// ); -// } -// -// @Override -// public KtCommonResponse excaAcmd(KtTokenExcaRequest reqDTO) { -// final CmmEnsRlaybsnmDTO ktMnsInfo = CmmKtMmsUtils.getRlaybsnmInfo(reqDTO.getSignguCode(), reqDTO.getFfnlgCode()); -// //reqDTO.setServiceCd(ktMnsInfo.get); -// //reqDTO.setServiceKey(ktMnsInfo.get); -// CmmEnsUtils.validate(reqDTO); -// -// return webClient.exchangeKt( -// HOST + API_EXCA_ACMD, -// HttpMethod.POST, -// JsonUtils.toJson(reqDTO), -// KtCommonResponse.class, -// ktMnsInfo -// ); -// } -// -// @Override -// public KtExcaResponse exca(final KtExcaRequest reqDTO) { -// final CmmEnsRlaybsnmDTO ktMnsInfo = CmmKtMmsUtils.getRlaybsnmInfo(reqDTO.getSignguCode(), reqDTO.getFfnlgCode()); -// //reqDTO.setServiceCd(ktMnsInfo.get); -// //reqDTO.setServiceKey(ktMnsInfo.get); -// CmmEnsUtils.validate(reqDTO); -// -// return webClient.exchangeKt( -// HOST + API_EXCA, -// HttpMethod.POST, -// JsonUtils.toJson(reqDTO), -// KtExcaResponse.class, -// ktMnsInfo -// ); -// } -// -// @Override -// public KtAcmdInfoResponse infoAcmd(final KtAcmdInfoRequest reqDTO) { -// final CmmEnsRlaybsnmDTO ktMnsInfo = CmmKtMmsUtils.getRlaybsnmInfo(reqDTO.getSignguCode(), reqDTO.getFfnlgCode()); -// //reqDTO.setServiceCd(ktMnsInfo.get); -// //reqDTO.setServiceKey(ktMnsInfo.get); -// CmmEnsUtils.validate(reqDTO); -// -// return webClient.exchangeKt( -// HOST + API_INFO_ACMD, -// HttpMethod.POST, -// JsonUtils.toJson(reqDTO), -// KtAcmdInfoResponse.class, -// ktMnsInfo -// ); -// } -// -// @Override -// public KtAcmdInfoCfmResponse cfmAcmd(final KtAcmdInfoCfmRequest reqDTO) { -// final CmmEnsRlaybsnmDTO ktMnsInfo = CmmKtMmsUtils.getRlaybsnmInfo(reqDTO.getSignguCode(), reqDTO.getFfnlgCode()); -// //reqDTO.setServiceCd(ktMnsInfo.get); -// //reqDTO.setServiceKey(ktMnsInfo.get); -// CmmEnsUtils.validate(reqDTO); -// -// return webClient.exchangeKt( -// HOST + API_CFM_ACMD, -// HttpMethod.POST, -// JsonUtils.toJson(reqDTO), -// KtAcmdInfoCfmResponse.class, -// ktMnsInfo -// ); -// } } diff --git a/mens-api/src/main/java/kr/xit/biz/sisul/service/BizSisulService.java b/mens-api/src/main/java/kr/xit/biz/sisul/service/BizSisulService.java index 384e99d..3302526 100644 --- a/mens-api/src/main/java/kr/xit/biz/sisul/service/BizSisulService.java +++ b/mens-api/src/main/java/kr/xit/biz/sisul/service/BizSisulService.java @@ -312,13 +312,6 @@ public class BizSisulService extends EgovAbstractServiceImpl implements IBizSisu String unitySndngMastrId = ""; String[] ppMasterJson = new String[2]; - for(FmcInfExcelRslt dto : rslts){ - if(StringUtils.isEmpty(String.join("", dto.getCi1(), dto.getCi2()))){ - errCnt++; - } - mapper.insertCi(dto); - } - for(FmcInfExcel dto : fmcExcels){ //최초 1회 CNTC master 생성 if(StringUtils.isNotEmpty(dto.getUnitySndngMastrId()) && mst == 0){ @@ -385,6 +378,13 @@ public class BizSisulService extends EgovAbstractServiceImpl implements IBizSisu ); } + for(FmcInfExcelRslt dto : rslts){ + if(StringUtils.isEmpty(String.join("", dto.getCi1(), dto.getCi2()))){ + errCnt++; + } + mapper.insertCi(dto); + } + return String.format( "전자고지 대상 %d건 Upload[완료-%d건, 오류-%d건]", rslts.size(), diff --git a/mens-core/src/main/java/kr/xit/core/spring/config/support/HttpsConnectorConfig.java b/mens-core/src/main/java/kr/xit/core/spring/config/support/HttpsConnectorConfig.java index 367a725..06cbc49 100644 --- a/mens-core/src/main/java/kr/xit/core/spring/config/support/HttpsConnectorConfig.java +++ b/mens-core/src/main/java/kr/xit/core/spring/config/support/HttpsConnectorConfig.java @@ -8,7 +8,6 @@ import javax.net.ssl.SSLContext; import javax.net.ssl.SSLSession; import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager; -import kr.xit.core.exception.BizRuntimeException; import org.apache.catalina.Context; import org.apache.catalina.connector.Connector; import org.apache.tomcat.util.descriptor.web.SecurityCollection; @@ -54,11 +53,11 @@ public class HttpsConnectorConfig { public ServletWebServerFactory servletContainer() { TomcatServletWebServerFactory tomcat = null; - try { - ignoreSsl(); - } catch (Exception e) { - throw BizRuntimeException.create(e.getMessage()); - } +// try { +// ignoreSsl(); +// } catch (Exception e) { +// throw BizRuntimeException.create(e.getMessage()); +// } if(SSL_REDIRECT){ tomcat = new TomcatServletWebServerFactory() { diff --git a/mens-core/src/main/java/kr/xit/core/spring/handler/CustomRestExceptionHandler.java b/mens-core/src/main/java/kr/xit/core/spring/handler/CustomRestExceptionHandler.java index a21f539..aaeee1b 100644 --- a/mens-core/src/main/java/kr/xit/core/spring/handler/CustomRestExceptionHandler.java +++ b/mens-core/src/main/java/kr/xit/core/spring/handler/CustomRestExceptionHandler.java @@ -5,7 +5,6 @@ import java.util.Map; import java.util.NoSuchElementException; import java.util.concurrent.CompletionException; import javax.validation.ConstraintViolationException; -import kr.xit.core.consts.ErrorCode; import kr.xit.core.exception.BizRuntimeException; import kr.xit.core.model.ApiResponseDTO; import kr.xit.core.spring.util.error.ErrorParse; @@ -153,11 +152,20 @@ public class CustomRestExceptionHandler extends ResponseEntityExceptionHandler { * * @return ErrorResponse */ - @ExceptionHandler(value = {ConstraintViolationException.class, DataIntegrityViolationException.class}) + @ExceptionHandler(value = {ConstraintViolationException.class}) @ResponseStatus(value = HttpStatus.BAD_REQUEST) - protected ApiResponseDTO handleDataException() { - log.error("==== throw ConstraintViolationException, DataIntegrityViolationException ===================="); - return ApiResponseDTO.error(ErrorCode.SQL_DATA_RESOURCE_INVALID); + protected ApiResponseDTO handleDataException(ConstraintViolationException e) { + log.error("==== throw ConstraintViolationException ====================\n{}", e.getMessage()); + return sendError(e); + //return ApiResponseDTO.error(ErrorCode.SQL_DATA_RESOURCE_INVALID); + } + + @ExceptionHandler(value = {DataIntegrityViolationException.class}) + @ResponseStatus(value = HttpStatus.BAD_REQUEST) + protected ApiResponseDTO handleDataException(DataIntegrityViolationException e) { + log.error("==== throw DataIntegrityViolationException ====================\n{}", e.getMessage()); + return sendError(e); + //return ApiResponseDTO.error(ErrorCode.SQL_DATA_RESOURCE_INVALID); } /**