新增规格逻辑修改,新增激活码到期时间,激活码时间校验

This commit is contained in:
liuyingfang
2024-03-06 14:42:56 +08:00
parent cfbabc1fb3
commit 0f46ddf8c9
9 changed files with 61 additions and 29 deletions

View File

@@ -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();
}
}

View File

@@ -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(","))