fix: 재열람만료일시와 마감일시 유효성 체크 활성화

main
Jonguk. Lim 2 months ago
parent 7545312a8f
commit ac6919ca58

@ -459,4 +459,152 @@ public class DateUtil {
public static LocalDateTime localDateTime() {
return LocalDateTime.now();
}
/**
* <pre>
* : 2020-06-22T23:20:32 ISO 'T' .
* sourceDate > compareDate = true
* sourceDate < compareDate = false
* sourceDate == compareDate = false
*
* @param sourceDate --
* @param compareDate --
* @return boolean
* </pre>
*/
public static boolean isAfterLocalDateTimeT(final String sourceDate, final String compareDate) {
boolean result = false;
try {
LocalDateTime source = parseLocalDateTime(sourceDate);
result = source.isAfter(parseLocalDateTime(compareDate));
} catch (Exception e) {
log.error("DateUtils::isAfterLocalDate", e);
}
return result;
}
/**
* <pre>
* add : 2020-06-22T23:20:32
* .
* ex : -1 = 1
*
* @param targetDate --
* @param day
* @return String
* </pre>
*/
public static String getAddDayT(final String targetDate, final int day) {
return getCalculatorDateAndTime(targetDate, 0, 0, day, 0, 0, 0);
}
/**
* LocalDate.parse
*
* @param target yyyy-MM-dd
* @return LocalDate.parse(tartget);
*/
public static LocalDate parseLocalDate(final String target) {
return LocalDate.parse(target);
}
/**
* LocalDateTime.parse
*
* @param target yyyy-MM-dd HH:mm:ss
* @return LocalDateTime.parse(tartget);
*/
public static LocalDateTime parseLocalDateTime(final String target) {
return LocalDateTime.parse(target);
}
/**
* <pre>
* microsecond
* yyyyMMddHHmmssSSSSSSS
* <pre>
* @return String yyyyMMddHHmmssSSSSSSS
*/
public static String getNowTimeMicrosecond() {
ZonedDateTime now = ZonedDateTime.now(ZoneId.of("Asia/Seoul"));
// 6자리 나노초까지 포함된 포맷 지정
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSSSSSS");
return now.format(formatter);
}
/**
* <pre>
*
* -- ( )
*
* .
* ex : -1 = 1
*
* @param targetDate --
* @param year
* @param month
* @param day
* @return String
* </pre>
*/
public static String getCalculatorDate(final String targetDate, final int year, final int month, final int day) {
String result = "";
try {
LocalDate localDate = parseLocalDate(targetDate);
localDate = localDate.plusYears(year);
localDate = localDate.plusMonths(month);
localDate = localDate.plusDays(day);
result = localDate.toString();
} catch (Exception e) {
log.error("DateUtils::getCalculatorDate", e);
}
return result;
}
/**
* <pre>
* & --THH:mm:ss ( )
* 2020-06-22T23:20:32 ISO 'T' .
* ex : -1 = 1
*
* @param targetDate --T::
* @param year
* @param month
* @param day
* @param hour
* @param minute
* @param second
* @return String
* </pre>
*/
public static String getCalculatorDateAndTime(final String targetDate, final int year, final int month, final int day, int hour, int minute, int second) {
String result = "";
try {
LocalDateTime localDateTime = parseLocalDateTime(targetDate);
localDateTime = localDateTime.plusYears(year);
localDateTime = localDateTime.plusMonths(month);
localDateTime = localDateTime.plusDays(day);
localDateTime = localDateTime.plusHours(hour);
localDateTime = localDateTime.plusMinutes(minute);
localDateTime = localDateTime.plusSeconds(second);
result = localDateTime.toString();
} catch (Exception e) {
log.error("DateUtils::getCalculatorDateAndTime", e);
}
return result;
}
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"));
System.out.println(isAfterLocalDateTimeT("2024-10-31T23:59:59", "2024-10-30T23:59:58"));
System.out.println(getNowTimeMicrosecond());
System.out.println(getAddDayT(getTimeTOfTime("20241030235959"), 1));
}
}

@ -108,8 +108,8 @@ public class KkoTalkAcceptor implements EnsPhaseProcSupport<EnsResponseVO<?>, Kk
if (!CmmnUtil.isEmpty(document.getReviewExpiresAt())) {
String expDate = DateUtil.getTimeOfTimeT(document.getReviewExpiresAt(), "yyyyMMddHHmmss");
int sec = DateUtil.secByFromBetweenTo(DateUtil.toLocalDateTime(expDate), DateUtil.toLocalDateTime(reqDTO.getClose_dt()));
if (sec < 0)
result.add(String.format("마감일시보다 \"재열람 만료일시\"가 느립니다. [ document[%d].acpt_data.kko_talk.readExpiresAt ]", i.get()));
if (sec > 0)
result.add(String.format("마감일시보다 \"재열람 만료일시\"가 빠릅니다. [ document[%d].acpt_data.kko_talk.readExpiresAt ]", i.get()));
}
}
i.getAndIncrement();

Loading…
Cancel
Save