Commit 1f903468 authored by huyuchen's avatar huyuchen

Merge remote-tracking branch 'origin/MVP1.7.18' into MVP1.7.18

parents 394cc4cc a5203e59
package com.yifu.cloud.plus.v1.yifu.common.core.util; package com.yifu.cloud.plus.v1.yifu.common.core.util;
import com.alibaba.excel.converters.date.DateDateConverter;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.sms.MonthObject; import com.yifu.cloud.plus.v1.yifu.common.core.util.sms.MonthObject;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -1984,6 +1983,20 @@ public class DateUtil { ...@@ -1984,6 +1983,20 @@ public class DateUtil {
return false; return false;
} }
/**
* @Author fxj
* @Description 判断 日期 date 是否在 registDate 之后,在返回true,否则返回false
* @Date 15:10 2025/12/12
* @Param
* @return
**/
public static boolean isBefore(Date date, Date registDate) {
if (date.getTime() < registDate.getTime()) {
return true;
}
return false;
}
/** /**
* 日期月份类型枚举 * 日期月份类型枚举
*/ */
...@@ -2014,7 +2027,7 @@ public class DateUtil { ...@@ -2014,7 +2027,7 @@ public class DateUtil {
} }
// 获取当前月份的第一天 // 获取当前月份的第一天
Date currentMonthFirstDay = DateUtil.setDayByDate(new Date(), 1); Date currentMonthFirstDay = DateUtil.setDayByDate(DateUtil.formatDateByPatten(new Date(), DateUtil.ISO_EXPANDED_DATE_FORMAT), 1);
// 获取下个月的第一天 // 获取下个月的第一天
Date nextMonthFirstDay = DateUtil.addMonthByDate(currentMonthFirstDay, 1); Date nextMonthFirstDay = DateUtil.addMonthByDate(currentMonthFirstDay, 1);
...@@ -2023,11 +2036,11 @@ public class DateUtil { ...@@ -2023,11 +2036,11 @@ public class DateUtil {
Date nextNextMonthFirstDay = DateUtil.addMonthByDate(currentMonthFirstDay, 2); Date nextNextMonthFirstDay = DateUtil.addMonthByDate(currentMonthFirstDay, 2);
// 判断目标日期是否早于下个月第一天 // 判断目标日期是否早于下个月第一天
if (!DateUtil.isAfter(targetDate, nextMonthFirstDay)) { if (DateUtil.isBefore(targetDate, nextMonthFirstDay)) {
return MonthType.CURRENT_OR_BEFORE; return MonthType.CURRENT_OR_BEFORE;
} }
// 判断目标日期是否早于下下个月第一天 // 判断目标日期是否早于下下个月第一天
else if (!DateUtil.isAfter(targetDate, nextNextMonthFirstDay)) { else if (DateUtil.isBefore(targetDate, nextNextMonthFirstDay)) {
return MonthType.NEXT_MONTH; return MonthType.NEXT_MONTH;
} }
// 其他情况为次次月及之后 // 其他情况为次次月及之后
...@@ -2037,7 +2050,7 @@ public class DateUtil { ...@@ -2037,7 +2050,7 @@ public class DateUtil {
} }
/** /**
* 判断给定日期是否为当月及之前月份 * 判断给定日期是否为当月及之前月份 比较日期不带时分秒
* *
* @param targetDate 目标日期 * @param targetDate 目标日期
* @return true: 当月及之前月份, false: 之后月份 * @return true: 当月及之前月份, false: 之后月份
...@@ -2047,7 +2060,7 @@ public class DateUtil { ...@@ -2047,7 +2060,7 @@ public class DateUtil {
} }
/** /**
* 判断给定日期是否为次月 * 判断给定日期是否为次月 比较日期不带时分秒
* *
* @param targetDate 目标日期 * @param targetDate 目标日期
* @return true: 次月, false: 其他月份 * @return true: 次月, false: 其他月份
...@@ -2057,7 +2070,7 @@ public class DateUtil { ...@@ -2057,7 +2070,7 @@ public class DateUtil {
} }
/** /**
* 判断给定日期是否为次次月及之后月份 * 判断给定日期是否为次次月及之后月份 比较日期不带时分秒
* *
* @param targetDate 目标日期 * @param targetDate 目标日期
* @return true: 次次月及之后月份, false: 之前月份 * @return true: 次次月及之后月份, false: 之前月份
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment