火点重构-完善防火季订阅

This commit is contained in:
liuchengqian 2023-04-13 16:14:54 +08:00
parent 5bee4ddf83
commit 966835c304
2 changed files with 9 additions and 13 deletions

View File

@ -37,14 +37,14 @@ public class TimeRangeUtils {
} }
/** /**
* 检查VIP是否过期(OK) * 检查VIP是否过期
*/ */
public static boolean checkIfVipExpired(String vipTimeRangeJson) { public static boolean checkIfVipExpired(String vipTimeRangeJson) {
return !checkIfVipValid(vipTimeRangeJson); return !checkIfVipValid(vipTimeRangeJson);
} }
/** /**
* 获取VIP范围列表(OK) * 获取VIP范围列表
*/ */
public static List<DataWrapper2<LocalDateTime, LocalDateTime>> getVipRangeList(String vipTimeRangeJson) { public static List<DataWrapper2<LocalDateTime, LocalDateTime>> getVipRangeList(String vipTimeRangeJson) {
List<DataWrapper2<LocalDateTime, LocalDateTime>> vipRangeList = new ArrayList<>();//VIP范围结果列表 List<DataWrapper2<LocalDateTime, LocalDateTime>> vipRangeList = new ArrayList<>();//VIP范围结果列表
@ -78,14 +78,14 @@ public class TimeRangeUtils {
} }
/** /**
* 检查试用期是否过期(OK) * 检查试用期是否过期
*/ */
public static boolean checkIfProbationExpired(String addTime, Long dayNum) { public static boolean checkIfProbationExpired(String addTime, Long dayNum) {
return !checkIfProbationValid(addTime, dayNum); return !checkIfProbationValid(addTime, dayNum);
} }
/** /**
* 获取试用期范围(OK) * 获取试用期范围
*/ */
public static DataWrapper2<LocalDateTime, LocalDateTime> getProbationRange(String addTime, Long dayNum) { public static DataWrapper2<LocalDateTime, LocalDateTime> getProbationRange(String addTime, Long dayNum) {
DateTimeUtils.checkDateTimeFormat(addTime); DateTimeUtils.checkDateTimeFormat(addTime);

View File

@ -2,8 +2,6 @@ package com.xkrs.utilsnew;
import com.xkrs.model.bean.VipTimeRangeBean; import com.xkrs.model.bean.VipTimeRangeBean;
import org.apache.hc.core5.util.TextUtils; import org.apache.hc.core5.util.TextUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
@ -11,8 +9,6 @@ import java.util.List;
public class VipTimeRangeUtils { public class VipTimeRangeUtils {
public static Logger log = LoggerFactory.getLogger(VipTimeRangeUtils.class);
private VipTimeRangeUtils() { private VipTimeRangeUtils() {
} }
@ -25,8 +21,8 @@ public class VipTimeRangeUtils {
LocalDateTime startLocalDateTime = LocalDateTime.now(); LocalDateTime startLocalDateTime = LocalDateTime.now();
if (startLocalDateTime.isBefore(newLocalDateTime)) { if (startLocalDateTime.isBefore(newLocalDateTime)) {
VipTimeRangeBean.VipTimeRangeItemBean vipTimeRangeItemBean = new VipTimeRangeBean.VipTimeRangeItemBean(); VipTimeRangeBean.VipTimeRangeItemBean vipTimeRangeItemBean = new VipTimeRangeBean.VipTimeRangeItemBean();
vipTimeRangeItemBean.setStartTime(DateTimeUtils.DATE_TIME_FORMATTER_1.format(startLocalDateTime)); vipTimeRangeItemBean.setStartTime(DateTimeUtils.localDateTimeToString(startLocalDateTime));
vipTimeRangeItemBean.setEndTime(DateTimeUtils.DATE_TIME_FORMATTER_1.format(newLocalDateTime)); vipTimeRangeItemBean.setEndTime(DateTimeUtils.localDateTimeToString(newLocalDateTime));
List<VipTimeRangeBean.VipTimeRangeItemBean> list = new ArrayList<>(); List<VipTimeRangeBean.VipTimeRangeItemBean> list = new ArrayList<>();
list.add(vipTimeRangeItemBean); list.add(vipTimeRangeItemBean);
VipTimeRangeBean vipTimeRangeBean = new VipTimeRangeBean(); VipTimeRangeBean vipTimeRangeBean = new VipTimeRangeBean();
@ -78,8 +74,8 @@ public class VipTimeRangeUtils {
LocalDateTime startLocalDateTime = LocalDateTime.now(); LocalDateTime startLocalDateTime = LocalDateTime.now();
if (startLocalDateTime.isBefore(newLocalDateTime)) { if (startLocalDateTime.isBefore(newLocalDateTime)) {
VipTimeRangeBean.VipTimeRangeItemBean vipTimeRangeItemBean = new VipTimeRangeBean.VipTimeRangeItemBean(); VipTimeRangeBean.VipTimeRangeItemBean vipTimeRangeItemBean = new VipTimeRangeBean.VipTimeRangeItemBean();
vipTimeRangeItemBean.setStartTime(DateTimeUtils.DATE_TIME_FORMATTER_1.format(startLocalDateTime)); vipTimeRangeItemBean.setStartTime(DateTimeUtils.localDateTimeToString(startLocalDateTime));
vipTimeRangeItemBean.setEndTime(DateTimeUtils.DATE_TIME_FORMATTER_1.format(newLocalDateTime)); vipTimeRangeItemBean.setEndTime(DateTimeUtils.localDateTimeToString(newLocalDateTime));
list.add(vipTimeRangeItemBean); list.add(vipTimeRangeItemBean);
return JsonUtils.<VipTimeRangeBean>serialize(vipTimeRangeBean); return JsonUtils.<VipTimeRangeBean>serialize(vipTimeRangeBean);
} else { } else {
@ -90,7 +86,7 @@ public class VipTimeRangeUtils {
//调整VIP用户过期时间的方案是调整结束时间为传入的时间 //调整VIP用户过期时间的方案是调整结束时间为传入的时间
LocalDateTime startLocalDateTime = LocalDateTime.parse(lastVipTimeRangeItemBean.getStartTime(), DateTimeUtils.DATE_TIME_FORMATTER_1); LocalDateTime startLocalDateTime = LocalDateTime.parse(lastVipTimeRangeItemBean.getStartTime(), DateTimeUtils.DATE_TIME_FORMATTER_1);
if (startLocalDateTime.isBefore(newLocalDateTime)) { if (startLocalDateTime.isBefore(newLocalDateTime)) {
lastVipTimeRangeItemBean.setEndTime(DateTimeUtils.DATE_TIME_FORMATTER_1.format(newLocalDateTime)); lastVipTimeRangeItemBean.setEndTime(DateTimeUtils.localDateTimeToString(newLocalDateTime));
return JsonUtils.<VipTimeRangeBean>serialize(vipTimeRangeBean); return JsonUtils.<VipTimeRangeBean>serialize(vipTimeRangeBean);
} else { } else {
throw new RuntimeException("设置的过期时间必须晚于当次的VIP开始时间"); throw new RuntimeException("设置的过期时间必须晚于当次的VIP开始时间");