From 6492b10934b2f72fc34f5bfaaffcf1e8a5c42d52 Mon Sep 17 00:00:00 2001 From: "Jonguk. Lim" Date: Fri, 4 Oct 2024 14:39:23 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20NICE=20CI=20accept=20=EC=A7=84=ED=96=89?= =?UTF-8?q?=20=20=20=20=20=20=20expire=5Fat=20=EC=84=A4=EC=A0=95=20?= =?UTF-8?q?=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cokr/xit/ens/core/utils/DateUtil.java | 12 ++++++++++ .../nice/service/NiceCiAcceptService.java | 22 +++++++++---------- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/src/main/java/cokr/xit/ens/core/utils/DateUtil.java b/src/main/java/cokr/xit/ens/core/utils/DateUtil.java index 37ad0ef..a429383 100644 --- a/src/main/java/cokr/xit/ens/core/utils/DateUtil.java +++ b/src/main/java/cokr/xit/ens/core/utils/DateUtil.java @@ -600,6 +600,18 @@ public class DateUtil { return result; } + /** + * LocalDateTime 을 pattern 포맷의 스트링으로 return + * @param localDateTime LocalDateTime + * @param pattern yyyyMMddHHmmss 등의 포맷 + * @return pattern 형태의 스트링 문자열 + */ + public static String getStringFromLocalDate(final LocalDateTime localDateTime, String pattern) { + if ("".equals(pattern) || pattern == null) + pattern = DEFAULT_YMD_DT_FMT; + return localDateTime.format(DateTimeFormatter.ofPattern(pattern)); + } + public static void main(String[] args) { System.out.println(getAddDayT("2024-10-30T23:59:59", 1)); System.out.println(isAfterLocalDateTimeT("2024-10-30T23:59:59", "2024-10-30T23:59:58")); diff --git a/src/main/java/cokr/xit/ens/modules/nice/service/NiceCiAcceptService.java b/src/main/java/cokr/xit/ens/modules/nice/service/NiceCiAcceptService.java index f29b4a5..486facd 100644 --- a/src/main/java/cokr/xit/ens/modules/nice/service/NiceCiAcceptService.java +++ b/src/main/java/cokr/xit/ens/modules/nice/service/NiceCiAcceptService.java @@ -100,19 +100,17 @@ public class NiceCiAcceptService { d.setInputDataXits(niceCiMapper.selectNiceCiAcceptDatas(niceCiParam)); }); - //List bills = new ArrayList<>(); - //List billKkos = new ArrayList<>(); - final String prefixBillUid = PostSeCd.intgrnNoti.getCode() + "-" + IdGenerator.getCurrentTimeSec(); - final String expireAt = DateUtil.getTodayAndNowTime("YYYYMMddHHmmss"); + final String prefixBillUid = PostSeCd.intgrnNoti.getCode() + "-" + IdGenerator.getCurrentTimeSec(); final KkoPayUrlRespData kkoPayUrlRespData = KkoPayUrlRespData.builder() .customUrl(CustomUrl.builder() .noticeUrl(BILL_HOST + BILL_NOTICE_URL) .prepayUrl(BILL_HOST + BILL_PREPAY_URL) .payResultUrl(BILL_HOST + BILL_PAYREUSLT_URL) .build()) - .expireAt(expireAt) + .expireAt(DateUtil.getStringFromLocalDate(list.get(0).getExpiresDt(), "yyyyMMddHHmmss")) .build(); + final OrgMng orgMng = niceCiMapper.selectKkoBpApiUrlFromEnsOrgMng(list.get(0).getOrgCd()) .orElseThrow(() -> new EnsException(EnsErrCd.NO_DATA_FOUND, EnsErrCd.NO_DATA_FOUND.getCodeNm())); @@ -121,7 +119,7 @@ public class NiceCiAcceptService { try { List inputDataXits = xit.getInputDataXits(); for (NiceCiDTO.InputDataXit data : inputDataXits) { - BillKkoApiRespDTO respDTO = getPayUrl(xit, data, billHistDTO, orgMng, kkoPayUrlRespData); + BillKkoApiRespDTO respDTO = getPayUrl(data, billHistDTO, orgMng, kkoPayUrlRespData); data.setPayUrl(String.valueOf(respDTO.getData())); niceCiMapper.updatePayUrlOfDataInput(data); @@ -150,7 +148,7 @@ public class NiceCiAcceptService { .billerNoticeKey(billUid) // FIXME: 저장형태 확인 필요 .customUrl(gson.toJson(kkoPayUrlRespData.getCustomUrl())) - .expireAt(expireAt) //d.getExpiresDt() + .expireAt(kkoPayUrlRespData.getExpireAt()) //d.getExpiresDt() .billUid(billUid) .build() ); @@ -186,11 +184,13 @@ public class NiceCiAcceptService { * "mseeage": "정상응답" * "data": {"url":"https://billgates-web.kakao.com/r/platform/pages/paynow/search/1832/11/1a481760-b0da-4a77-9a7a-74951db5fa01"} * } - * @param data - * @param orgMng - * @return + * @param dataXit NiceCiDTO.InputDataXit + * @param billHistDTO NiceCiDTO.BillHistDTO + * @param orgMng OrgMng + * @param kkoPayUrlRespData KkoPayUrlRespData + * @return KkoPayUrlRespData */ - private BillKkoApiRespDTO getPayUrl(final NiceCiDTO.InputXit xitData, final NiceCiDTO.InputDataXit dataXit, NiceCiDTO.BillHistDTO billHistDTO, final OrgMng orgMng, final KkoPayUrlRespData kkoPayUrlRespData){ + private BillKkoApiRespDTO getPayUrl(final NiceCiDTO.InputDataXit dataXit, NiceCiDTO.BillHistDTO billHistDTO, final OrgMng orgMng, final KkoPayUrlRespData kkoPayUrlRespData){ // FIXME: 파라메터 확인 필요 Map map = new HashMap<>(); map.put("biller_user_key", dataXit.getDataId());