fix: 카카오톡 재열람 만료시간 설정 반영

최초열람마감시간 + 1일
dev
Jonguk. Lim 2 months ago
parent 2af51825ab
commit 65948b18de

@ -15,17 +15,15 @@ public class AcptDocKkoTalk implements Accept<KkotalkApiDTO.Envelope> {
@Override @Override
public KkotalkApiDTO.Envelope createDocument() { public KkotalkApiDTO.Envelope createDocument() {
final String readExpiresAt = DateUtil.getTimeTOfTime(tbInputDataXit.getTbInputXit().getPayExpiresDt().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")));
return KkotalkApiDTO.Envelope.builder() return KkotalkApiDTO.Envelope.builder()
.hash(null) .hash(null)
.content( .content(
KkotalkApiDTO.Content.builder() KkotalkApiDTO.Content.builder()
.link(redirectUrl) .link(redirectUrl)
.build()) .build())
.readExpiresAt( .readExpiresAt(readExpiresAt)
DateUtil.getTimeTOfTime(tbInputDataXit.getTbInputXit().getPayExpiresDt().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")))) .reviewExpiresAt(DateUtil.getAddDayT(readExpiresAt, 1))
// FIXME: readExpiresAt + 1일로 설정
.reviewExpiresAt(
"2024-10-30T23:59:59")
.build(); .build();
} }
} }

@ -459,4 +459,136 @@ public class DateUtil {
public static LocalDateTime localDateTime() { public static LocalDateTime localDateTime() {
return LocalDateTime.now(); 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>
*
* -- ( )
*
* .
* 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"));
}
} }

Loading…
Cancel
Save