新增规格逻辑修改,新增激活码到期时间,激活码时间校验
This commit is contained in:
@@ -170,4 +170,23 @@ public class DateUtil {
|
||||
public static LocalDateTime parseLocalDateTimeFormatyMdHms(String localDateTime) {
|
||||
return LocalDateTime.from(DFY_MD_HMS.parse(localDateTime));
|
||||
}
|
||||
|
||||
/**
|
||||
* 激活码到期时间
|
||||
* @param monthsToAdd
|
||||
* @return
|
||||
*/
|
||||
public static long addMonthsAndGetTimestamp(int monthsToAdd) {
|
||||
// 获取当前日期时间
|
||||
ZonedDateTime now = ZonedDateTime.now();
|
||||
|
||||
// 增加月份
|
||||
LocalDate dateAfterMonths = now.toLocalDate().plusMonths(monthsToAdd);
|
||||
|
||||
// 将日期设置为下一个月的最后一天
|
||||
ZonedDateTime newDateTime = dateAfterMonths.atStartOfDay(now.getZone());
|
||||
|
||||
// 转换为时间戳
|
||||
return newDateTime.toInstant().toEpochMilli();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,6 +65,9 @@ public class ListUtil {
|
||||
}
|
||||
|
||||
public static List<String> stringChangeStringList(String listString){
|
||||
if (StringUtils.isEmpty(listString)){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
// 使用Fastjson将JSON字符串转换为JSONArray对象
|
||||
listString = listString.replaceAll("\"", "").replaceAll("\\[", "").replaceAll("\\]", "");
|
||||
List<String> stringList = Stream.of(listString.split(","))
|
||||
|
||||
Reference in New Issue
Block a user