From 2e95f2c8540a059461a15776a6ebbca79c54a541 Mon Sep 17 00:00:00 2001 From: bangae1 Date: Tue, 27 May 2025 00:11:15 +0000 Subject: [PATCH] =?UTF-8?q?=EB=93=B1=EB=A1=9D=EA=B8=B0=EA=B0=84=20?= =?UTF-8?q?=EC=A2=85=EB=A3=8C=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/kospo/svcm/config/utils/CommonUtils.java | 12 ++++++++++++ .../kospo/svcm/service/impl/EstimateServiceImpl.java | 4 +++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/kospo/svcm/config/utils/CommonUtils.java b/src/main/java/com/kospo/svcm/config/utils/CommonUtils.java index a862639..f25977b 100644 --- a/src/main/java/com/kospo/svcm/config/utils/CommonUtils.java +++ b/src/main/java/com/kospo/svcm/config/utils/CommonUtils.java @@ -115,6 +115,18 @@ public class CommonUtils { return result; } + public static Date stringToDate(String dd, String pattern) { + SimpleDateFormat sdf = new SimpleDateFormat(pattern); + Date result = null; + try { + result = sdf.parse(dd); + System.out.println(sdf.format(result)); + } catch (ParseException e) { + throw new RuntimeException(e); + } + return result; + } + public static String generateFileName() { LocalDateTime now = LocalDateTime.now(); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSSSSSS"); diff --git a/src/main/java/com/kospo/svcm/service/impl/EstimateServiceImpl.java b/src/main/java/com/kospo/svcm/service/impl/EstimateServiceImpl.java index 59a0b98..a54c2a7 100644 --- a/src/main/java/com/kospo/svcm/service/impl/EstimateServiceImpl.java +++ b/src/main/java/com/kospo/svcm/service/impl/EstimateServiceImpl.java @@ -69,7 +69,9 @@ public class EstimateServiceImpl implements EstimateService { Prcs prcs = optionalPrcs.get(); Date now = new Date(); - if(CommonUtils.stringToDate(prcs.getRegEdat()).getTime() <= now.getTime()) throw new CustomMessageException(CustomMessageException.CusMessage.builder() + Date end = CommonUtils.stringToDate(prcs.getRegEdat(), "yyyy-MM-dd"); + System.out.println(end.getTime() +"///"+ now.getTime()); + if(end.getTime() <= now.getTime()) throw new CustomMessageException(CustomMessageException.CusMessage.builder() .code("999999") .message("등록기간이 종료 되었습니다.") .build());